Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joemccann/561149 to your computer and use it in GitHub Desktop.
Save joemccann/561149 to your computer and use it in GitHub Desktop.
#!/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