Saving a json file to computer python

python, python-requests

Solution

You can do it just as you would without `requests`. Your code might look something like,

import json
import requests

solditems = requests.get('https://github.com/timeline.json') # (your url)
data = solditems.json()
with open('data.json', 'w') as f:
    json.dump(data, f)

Problem

Using `requests` in Python I am performing a GET, requesting a JSON file which I can later access and modify, tweak, etc. with the command `solditems.json()`. However I would like to save this JSON file to my computer. Looking through the requests docs I found nothing, does anybody have an easy way I can do this?

Original source