# Get the timeline for the 'twitter' user.
twitter_timeline = api.user_timeline(screen_name='twitter')
+# You can also setup up a cache.
+# Here we will use an in-memory cache with a timeout of 60 seconds.
+cached_api = tweepy.API(username, password, cache=tweepy.MemoryCache(timeout=60))
+
+# First request here will not be cached
+s = cached_api.get_status(id=123)
+
+# Now this request will be cached and won't require a trip to twitter's server.
+s_again = cached_api.get_status(id=123)
+
cache_result = api.cache.get(url, timeout)
if cache_result:
# if cache result found and not expired, return it
- print 'hit!!!!'
return cache_result
# Open connection