In [20]:
import requests
import pandas as pd

In [21]:
als_api_key = "o8r8WniAtWAe7LWg7hsRXi4FItdmsrW6Ta5gi9UW" # please make your own if you're actually using this
data = requests.get("https://api.open.fec.gov/v1/election-dates/?api_key=%s" % als_api_key).json()

In [22]:
df = pd.DataFrame.from_dict(data['results'])
df.head()


Out[22]:
create_date election_date election_district election_notes election_party election_state election_type_full election_type_id election_year office_sought primary_general_date update_date
0 2015-09-18T10:08:17+00:00 2017-01-10 NaN None None GA General runoff GR 2017 S 2015-10-16T01:32:11.131000 None
1 2015-09-18T10:08:17+00:00 2017-01-10 NaN None None GA General runoff GR 2017 H 2015-10-16T01:32:11.113000 None
2 2015-08-19T10:33:28+00:00 2016-12-10 NaN None None LA General runoff GR 2016 S 2015-10-16T01:30:40.594000 2015-09-25T12:32:25+00:00
3 2015-08-19T10:33:28+00:00 2016-12-10 NaN None None LA General runoff GR 2016 H 2015-10-16T01:30:40.576000 2015-09-25T12:32:14+00:00
4 2016-01-07T13:34:05+00:00 2016-11-22 NaN None None VI General runoff GR 2016 H 2016-01-08T02:24:12.562000 None