Spaces:
Sleeping
Sleeping
File size: 623 Bytes
7ba111a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Python script from here: https://data.millercenter.org/
import json, requests, sys
endpoint = "https://api.millercenter.org/speeches"
out_file = "speeches.json"
r = requests.post(url=endpoint)
data = r.json()
items = data['Items']
while 'LastEvaluatedKey' in data:
parameters = {"LastEvaluatedKey": data['LastEvaluatedKey']['doc_name']}
r = requests.post(url = endpoint, params = parameters)
data = r.json()
items += data['Items']
print(f'{len(items)} speeches')
with open(out_file, "w") as out:
out.write(json.dumps(items))
print(f'wrote results to file: {out_file}') |