Skip to content

Instantly share code, notes, and snippets.

@C00kiie
Created April 13, 2021 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save C00kiie/c25feba9eda940aeaf90e16f4e8100e3 to your computer and use it in GitHub Desktop.
Save C00kiie/c25feba9eda940aeaf90e16f4e8100e3 to your computer and use it in GitHub Desktop.
#!/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