Reputation: 111
url = cmsServiceBaseUrl
resp = requests.get(url,json=cmsServiceRequestBaseFormat)
return resp.get("data")
The resp type is <class 'requests.models.Response'>
but I want json
Upvotes: 2
Views: 3098
Reputation: 11866
You need to call resp.json()
.
The response will be a JSON parsed into a dictionary or a list of dictionaries.
Here is an example from the docs:
>>> import requests
>>> r = requests.get('https://api.github.com/events')
>>> r.json()
[{'repository': {'open_issues': 0, 'url': 'https://github.com/...
Upvotes: 1
Reputation: 384
You can get a json from the response like this
url=cmsServiceBaseUrl
resp=requests.get(url,json=cmsServiceRequestBaseFormat)
return resp.json()
Here is the related doc from requests: https://docs.python-requests.org/en/master/user/quickstart/#json-response-content
Upvotes: 0