<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,5 @@
+ff2tweet is meant to run as a script executed regularly by a daemon/service.
+
 Twitter API code is from http://mike.verdone.ca/twitter/
 FriendFeed API code is from http://code.google.com/p/friendfeed-api/
 Bit.ly API is from http://code.google.com/p/bitly-api/wiki/ApiDocumentation</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -9,9 +9,6 @@ import urllib2
 import twitter
 import sys
 
-import simplejson
-parse_json = lambda s: simplejson.loads(s.decode(&quot;utf-8&quot;))
-
 # Globals
 TWITTER_USERNAME = ''
 TWITTER_PASSWORD = ''
@@ -26,26 +23,26 @@ LAST_ENTRY_FILE = ''
 TWITTER_LIMIT_CHARS = 140
 SOURCE_NAME = &quot;ff2tweet&quot;
 
+def do_request(api_call):
+    request = urllib2.Request(api_call)
+    stream = urllib2.urlopen(request)
+    response = stream.read()
+    stream.close()
+    return response
+
 def shorten_url(link):
     if BITLY_USERNAME == '':
         api_call = &quot;http://bit.ly/api?url=&quot; + link
-        request = urllib2.Request(api_call)
-        stream = urllib2.urlopen(request)
-        url = stream.read()
-        stream.close()
-        return url
+        url = do_request(api_call)
     else:
         api_call = &quot;http://api.bit.ly/shorten?version=&quot; + BITLY_VERSION \
                     + &quot;&amp;longUrl=&quot; + link \
                     + &quot;&amp;login=&quot; + BITLY_USERNAME \
                     + &quot;&amp;apiKey=&quot; + BITLY_APIKEY
-        request = urllib2.Request(api_call)
-        stream = urllib2.urlopen(request)
-        response = stream.read()
-        stream.close()
+        response = do_request(api_call)
         op = parse_json(response)
         url = op[&quot;results&quot;][link][&quot;shortUrl&quot;]
-        return url
+    return url
 
 def post_tweet(tweet):
     tw_service = twitter.Twitter(TWITTER_USERNAME, TWITTER_PASSWORD)</diff>
      <filename>ff2tweet.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>511190ee16d37456ca37730342a2a7f1bd782914</id>
    </parent>
  </parents>
  <author>
    <name>Satyajit Grover</name>
    <email>samgrover@gmail.com</email>
  </author>
  <url>http://github.com/samgrover/ff2tweet/commit/5528e6a43d6442cd5abc6facdf7047b96281f2fa</url>
  <id>5528e6a43d6442cd5abc6facdf7047b96281f2fa</id>
  <committed-date>2009-03-31T21:01:06-07:00</committed-date>
  <authored-date>2009-03-31T21:01:06-07:00</authored-date>
  <message>A bit of clean up.</message>
  <tree>44d9fc30268bb182cf02a8372f02c78a2bee5acb</tree>
  <committer>
    <name>Satyajit Grover</name>
    <email>samgrover@gmail.com</email>
  </committer>
</commit>
