View On GitHub
Notes from my talk on using APIs at DataSwap 2013
Project maintained by
Hosted on GitHub Pages — Theme by
in python, "pip install sunlight"
Look up legislators by zip code or lat/long
Official Twitter, YouTube, and Facebook accounts.
Committees and subcommittees in Congress, including memberships and rankings.
Cody's talk showed grouping of federal legislators by frequency of voting similarity
Do stuff like this: an
depicting the ideological distribution of the Pennsylvania house and senate
Political Science Computational Library
Absurd amount of Political Science computation insanity
A friendlier Python wrapper for said computational insanity
Influence Explorer API
See it in action:
Programmatic access tracking the influence of money in politics
Search and filter individual contributions, contracts, grants and lobbying registrations.
Find the most active Politicians, Individuals, Organizations and Industries based on receipts, expenditures and lobbying.
See it an action at
State Metadata - Details on what data is available, including terms, sessions, and state-specific names for things.
Bills - Details on bills & resolutions, including actions & votes.
Legislators - Details on legislators, including contact details.
Committees - Details on committees as they currently stand.
Events - Details on upcoming events such as committee meetings and hearings.
Districts - Details on districts and their boundaries.
What kinds of stuff could you do with this data?
Predictive analytics for state legislations:
No one is doing this stuff (except fiscalnote.com)
Does anyone care? Mark Cuban just invested 1.2 Million in Fiscal Note
Legislative Hot or Not .COM
Republican/Democrat or not .COM
Canadian Legal Information Institute
Canadian Court Decisions
Network analysis of Canadian Court decision citations patterns
How complex are financial relationships? (OMG)[
Other useful APIs
Extract main content from a page (remove navigation, header, footer, etc)
Entity recognition--returns entities tagged with dbpedia, freebase IDs
Pass it unstructured text, get one or more normalized addresses in return
5 Tips for Working with APIs
Resist the urge to subscribe to non-free APIs, at least at first
Too often developers overcommit themselves to a certain technology--don't do it!
Try out different free APIs; throw out the ones that don't work for you
Later, inquire about free/cheap use for educational purposes
Some service will give you free unlimited use
Others only do that for 501(c)(3) nonprofit orgs
Free APIs can be flaky
Consider using an task queue like
Tasks succeeded or fail individually, can be retried individually
To maximize freeness, consider caching responses
Many APIs other data in JSON
You can insert those responses directly into NoSQL databases like MongoDB, CouchDB, Cassandra
You can create an unlimited (?) number of free 500MB of MongoDB databases
Resist the urge to cache response on disk: if you're using Amazon EC2, you'll be sorry
GO FORTH AND HACK!