The @WhoseRep Twitter bot pulls campaign finance data from OpenSecrets.org and US congressional member data from ProPublica.org to tweet small insights into government representatives.
For each tweet, a legislator and one of their top campaign contributors are chosen randomly, along with some additional information, such as a committee on which the legislator serves.
Example: "Rep John K Delaney (D-MD) accepted $13,250 from Nasdaq Inc. He serves in the Joint Economic Committee."
pip install tweepy
pip install python-congress
You will need to create a Twitter account and app for your bot.
You'll also need a Center for Responsive Politics API key and a ProPublica API key.
You may either rename sample.config.py as config.py and enter your keys there, or include them as environment variables.
'TWITTER_ACCESS_TOKEN' : '',
'TWITTER_ACCESS_TOKEN_SECRET' : '',
'TWITTER_CONSUMER_KEY' : '',
'TWITTER_CONSUMER_SECRET' : '',
'OPENSECRETS_API_KEY' : '',
'PROPUBLICA_API_KEY' : ''
python bot.py
There's a lot of interesting, publicly available data about US government representatives. How about extending this bot to tweet about voting records when a legislator is mentioned in the news?