I am using urllib.request for GET method.
The response type is -> HttpRequests <class , str>
Problem: pandas.json_normalize is not possible because of this error
TypeError: byte indices must be integers or slices, not str
Question: How can I normalize the response?
This is my code:
req = urllib.request.Request(url, headers=hdr)
req.get_method = lambda: 'GET'
response = urllib.request.urlopen(req)
print(response.getcode())
json_response=response.read())
### Normalize the response
pandas.json_normalize( data=json_response['results'], meta=['id', 'name'] )
and this is a part of my JSON:
{
"results": [{
"accountId": "d85b3704-60c9-474f-aecc-2886629c732e",
"id": "69fb205b25",
"partition": null,
"externalId": null,
"metadata": null,...