Getting Congressional Legislator Info using the Sunlight gem

Below is a sample of calling the sunlight gem to pull congressional member data and showing the output using table_print. I used table_print to make the command line output a little bit prettier and save some

You need to sign up for a free API key at the Sunlight Foundation and insert your key into line 4.

Running the code will give you the following output as of the publish date of this post.

Full docs for the sunlight gem are available here if you want to add fields or change the criteria which is hard coded to show legislators in Massachusetts.

Leave a Reply

Your email address will not be published. Required fields are marked *