Created
September 1, 2010 18:49
-
-
Save joemccann/561149 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.4 | |
import httplib, urllib, sys | |
twitter_handle = 'joemccann' | |
params = urllib.urlencode([ | |
('screen_name', twitter_handle) | |
]) | |
# Always use the following value for the Content-type header. | |
headers = { "Content-type": "application/x-www-form-urlencoded" } | |
conn = httplib.HTTPConnection('api.twitter.com') | |
conn.request('GET', '/1/statuses/user_timeline.json', params, headers) | |
response = conn.getresponse() | |
data = response.read() | |
conn.close | |
filename = "%s.json" % twitter_handle | |
print "\nWriting to file: %s\n" % filename | |
file = open(filename, 'w') | |
file.write(data) | |
file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment