How can I save one. dictionary json from a requests in txt. I tried to do this way more did not work.
import requests
import json
url = requests. get("https://search.ams.usda.gov/farmersmarkets/v1/data.svc/zipSearch?zip=46201")
response = json.loads(url.text)
arquivo = open("dados.txt", "w")
arquivo.write(response)
arquivo.close()
It creates the file "data.txt" plus it does not write the json dictionary data.