Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python3
import requests
pages_max_number = 10
api_url = 'https://jsonplaceholder.typicode.com/todos/{}'
f = open('/tmp/results.json', 'w')
results = []
for i in range(0,pages_max_number+1):
results.append(requests.get(api_url.format(i)).text)
fancy_json = ',\n'.join(results)
f.write(fancy_json)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment