Skip to content

Instantly share code, notes, and snippets.

@edavis
Created July 1, 2012 18:58
Show Gist options
  • Save edavis/3029256 to your computer and use it in GitHub Desktop.
Save edavis/3029256 to your computer and use it in GitHub Desktop.
Collect names and twitter accounts for Congress members
import sunlight, tablib
lawmakers = sunlight.congress.legislators()
names_and_twitter = tablib.Dataset(headers=('name', 'twitter'))
for lawmaker in lawmakers:
name = lawmaker['firstname'] + " " + lawmaker['lastname']
twitter = lawmaker['twitter_id']
names_and_twitter.append([name, twitter])
output = open('twitter.xls', 'wb')
output.write(names_and_twitter.xls)
output.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment