Hi
I've created an Google API that returns a json like this:
jsonData= {"Celda1":"XX",
"Celda2":"123"
};
return return ContentService
.createTextOutput(JSON.stringify(jsonData))
.setMimeType(ContentService.MimeType.JSON);
the API is executed correctly. executing this code:
r=requests.post(url, json=str(payload), headers=headers)
But I got an error in my ES8266 like this
------------------------------------------------------------------
Traceback (most recent call last):
File "<stdin>", line 1, n request
File "urequests.py", line 97, in request
NotImplementedError: Redirects not yet supported
May you help me? I would appreciate so much
Vic.
API return JSON, generate a urequest error
Re: API return JSON, generate a urequest error
This means your service is returning a 302 (or 30x) redirect.
The fastest way to debug this would be to modify urequests.py and add print statements to show the headers and data returned from the server. In particular, on the line where it raises that error "Redirects not yet supported", add a print to show the value of the location header.
By the way, in urequests, you can post json generated from a Python dictionary using the `json` kwarg to request.
e.g.
The fastest way to debug this would be to modify urequests.py and add print statements to show the headers and data returned from the server. In particular, on the line where it raises that error "Redirects not yet supported", add a print to show the value of the location header.
By the way, in urequests, you can post json generated from a Python dictionary using the `json` kwarg to request.
e.g.
Code: Select all
url = ...
headers = ...
jsonData= {"Celda1":"XX",
"Celda2":"123"
};
urequests.request(url, json=jsonData, headers=headers)