Strange ETIMEDOUT with urequests lib #14105
Replies: 6 comments 9 replies
-
This is a strange problem. When you contrast with an "internal" ip address, do you mean that your devices are on different subnet ranges, in which case you might want to dounle check your firewall routing between subnets. Also worth trying is to update requests to version 0.90 to see if that makes any difference (see https://github.com/micropython/micropython-lib/blob/master/python-ecosys/requests/manifest.py). |
Beta Was this translation helpful? Give feedback.
-
Can you guide me to update urequests to 0.9.0. I don't have pip installed on this version or I'm doing it wrong. |
Beta Was this translation helpful? Give feedback.
-
I was experiencing similar problems (ECONNRESET) in getting response from a simple asyncio-based http server on an esp32 and rp2040 clients using requests. I ended up modifying the @property
def content(self):
if self._cached is None:
blk=200 # 2 is min blk size
self._cached = b''
try:
while True:
data = self.raw.recv(blk)
self._cached += data
if len(data)<blk: break
finally:
self.raw.close()
self.raw = None
return self._cached As you can see, from the original Try it, it might work for you as well. |
Beta Was this translation helpful? Give feedback.
-
Hi, I tried to install another version of urequest in /lib, but it is not loaded |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks @shariltumin, @glenn20 for the time you took to help me and the analyses and solutions you provided The modified version of the library works fine. |
Beta Was this translation helpful? Give feedback.
-
FWIW, I ran into the same issue in an even more nondeterministic way. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have a strange problem with the urequests module.
The code runs on a Raspberry Pico-W and a Micropython:
recently updated:
MicroPython v1.22.2 on 2024-02-22; Raspberry Pi Pico W with RP2040
The urequests library is in version 0.8.0
I'm trying to access a URL with json data in return.
This request works with various URLs tested but not with the ESPHOME REST API.
Here's the code used:
this works well with an internal URL, for example:
But with a ESPHOME API REST URL,
URL = "http://192.168.0.x/sensor/huzzah_weather_pressure"
I have a ETIMEDOUT error
Yet this request works all the time with a curl under Linux for example.
The only difference I see with curl in verbose mode is that the connection seems to close before the data is available.
With a URL that works with curl and urequests:
With ESPHOME API REST URL:
Beta Was this translation helpful? Give feedback.
All reactions