Created
July 1, 2012 18:58
-
-
Save edavis/3029256 to your computer and use it in GitHub Desktop.
Collect names and twitter accounts for Congress members
This file contains 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
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