Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (15 sloc) 500 Bytes
import json
import shelve
import requests
'''
Loads the most recent 1500 tweets matching the search result
#takemymoneyHBO and stores them in a python shelf.
'''
shelf = shelve.open('hbotweets.dat')
shelf['tweets'] = []
for page in xrange(1,16):
query_params = {'q':'#takemymoneyHBO','result_type':'recent','rpp':'100','page':page}
r = requests.get('http://search.twitter.com/search.json',params=query_params)
tweets = json.loads(r.text)['results']
shelf['tweets'] += tweets
shelf.sync()
Jump to Line
Something went wrong with that request. Please try again.