<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -24,6 +24,7 @@ USER_AGENT = 'contwext/%s +http://github.com/kemayo/contwext/tree/master' % __ve
 TWITTER_URL = 'http://twitter.com'
 
 cache = {}
+status_cache = {}
 
 class Status(object):
     &quot;&quot;&quot;Represent a single twitter status update&quot;&quot;&quot;
@@ -106,7 +107,7 @@ def twitter_api(method, **kwargs):
     cache[url] = decoded_response
     return decoded_response
 
-def fetch_statuses(id, time, limit=10):
+def fetch_statuses(id, time, limit=10, method=&quot;statuses/user_timeline&quot;):
     &quot;&quot;&quot;Fetches statuses by a user until time&quot;&quot;&quot;
     complete = False
     page = 1
@@ -115,12 +116,13 @@ def fetch_statuses(id, time, limit=10):
         if page &gt; limit:
             # just give up if this is taking too long
             break
-        tweets = twitter_api(&quot;statuses/user_timeline&quot;, id=id, page=page)
+        tweets = twitter_api(method, id=id, page=page)
         if 'error' in tweets:
             # probably a protected user
             break
         for tweet in tweets:
             tweet = Status(tweet)
+            status_cache[tweet.id] = tweet
             if tweet.created_at &lt; time:
                 complete = True
                 break
@@ -130,10 +132,14 @@ def fetch_statuses(id, time, limit=10):
 
 def fetch_status(id):
     &quot;&quot;&quot;Fetch a single twitter update by id&quot;&quot;&quot;
+    if id in status_cache:
+        return status_cache[id]
     tweet = twitter_api('statuses/show/%s' % id)
     if 'error' in tweet:
         return False
-    return Status(tweet)
+    tweet = Status(tweet)
+    status_cache[id] = tweet
+    return tweet
 
 def fetch_conversation(id, time, guess=True, guess_threshold=timedelta(minutes=15), reply_threshold=timedelta(hours=6)):
     &quot;&quot;&quot;Attempt to fetch all tweets and their involved conversations for a given user, within a given time period&quot;&quot;&quot;
@@ -191,9 +197,7 @@ if __name__ == &quot;__main__&quot;:
     conversation = fetch_conversation(id, datetime.now() - timedelta(days=2), guess_threshold = timedelta(hours=1))
     for tweet in conversation:
         if tweet.user.screen_name == id:
-            #print tweet.html()
             print tweet
         else:
             print '***', tweet
-            #print '***', tweet.html()
 </diff>
      <filename>contwext.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>393262e7b84ec2793e256244c48128ad069db5e9</id>
    </parent>
  </parents>
  <author>
    <name>David Lynch</name>
    <email>kemayo@gmail.com</email>
  </author>
  <url>http://github.com/kemayo/contwext/commit/ccdd0b718b64fef35df6e256be3b45e3f155c2e9</url>
  <id>ccdd0b718b64fef35df6e256be3b45e3f155c2e9</id>
  <committed-date>2009-03-07T22:17:23-08:00</committed-date>
  <authored-date>2009-03-07T22:17:23-08:00</authored-date>
  <message>Per-status cache to prevent unnecessary refetching</message>
  <tree>5dd7f173c7d31b38c9ca496475fb646dc5d734fc</tree>
  <committer>
    <name>David Lynch</name>
    <email>kemayo@gmail.com</email>
  </committer>
</commit>
