import requests
req=requests.get(json_url)
with open('xxx','w') as f:
f.write(req.text)
file_requests=req.json()
requests is a module, get is a function, so req=requests.get(), but what is req.txt and req.json(), is it also a function?
import requests
req=requests.get(json_url)
with open('xxx','w') as f:
f.write(req.text)
file_requests=req.json()
requests is a module, get is a function, so req=requests.get(), but what is req.txt and req.json(), is it also a function?
This line:
requests.get(json_url)
return python object(http://docs.python-requests.org/en/master/api/#requests.Response)
requests.Response
:
json
(return http-body as json)May be it is property, (read https://www.python.org/dev/peps/pep-0549/)