Making request with urequests #11205
Replies: 3 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
So your app is working fine, doesn't look like a micropython issue.
What exactly do you get from the This smells like a routing and/or firewall problem (but I have not looked if/how urequests handles https:// URLs). Can you send requests using the browser on your mobile phone (or a laptop) connected to the same access point ? Maybe your cluster disallows requests from outside it's own network ? |
Beta Was this translation helpful? Give feedback.
-
Hey @karfas Thanks for the response. Error sending message: [Errno 103] ECONNABORTED
Error sending message: [Errno 103] ECONNABORTED On the other hand, like I said, I tried this simple GET request to the cat facts API and this is this error from the ESP8266 device
url = 'https://catfact.ninja/fact'
response = requests.get(url)
if response.status_code == 200:
json_data = json.loads(response.content)
print(json_data)
else:
print('Failed to get data. Status code:', response.status_code) Error I'm getting File "<stdin>", line 1, in <module>
File "urequests.py", line 116, in get
File "urequests.py", line 62, in request
OSError: -40 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey Team,
I have configured a Kubernetes kind cluster to run a flask API. The flask App when run locally with flask run produces an IP which is the local machine assigned IP from the local network (192.168.100.19). My ESP8266 which also has an IP of (192.168.100.36) can talk to the Flask API.
However, things are different when I run the Flask app from the kind cluster. The kind nodes are in the network of 192.168.64.1 so my nodes' IPs are in that range. I used metallb to create the IP pools in that range as well so my Flask API is given a Loadbalancer IP of 192.168.63.200 This Flask API IP cannot be communicated with the Nodemcu IP of 192.168.100.36
The Genesis of the issue is that, the ESP8266 cannot even make a GET request to any public API like getting cat facts from "https://catfact.ninja/fact" It can only communicate with a local running flask API
Below is my code logic to send a post request to a Flask API
Beta Was this translation helpful? Give feedback.
All reactions