adafruit / Adafruit_CircuitPython_Requests

Requests-like interface for web interfacing
MIT License
51 stars 36 forks source link

ETIMEDOUT on Metro M4 AirLift Lite #203

Open sam-k0 opened 1 month ago

sam-k0 commented 1 month ago

Hello adafruit community, I am following the guide on how to connect / request here: https://learn.adafruit.com/adafruit-metro-m4-express-airlift-wifi/internet-connect-2 I am using CircuitPython Version 9.1.1 and the onboard ESP has firmware ver. 1.2.2

And it works fine, connects to my wifi, gets an ip address, can ping google etc. but times out with this error when trying to execute below source code:

  File "code.py", line 76, in <module>
  File "adafruit_requests.py", line 701, in get
  File "adafruit_requests.py", line 647, in request
  File "adafruit_esp32spi/adafruit_esp32spi_socketpool.py", line 140, in recv
  File "adafruit_esp32spi/adafruit_esp32spi_socketpool.py", line 185, in recv_into
OSError: [Errno 116] ETIMEDOUT

Relevant source:

print("Fetching text from", TEXT_URL)
r = requests.get(TEXT_URL)
print("-" * 40)
print(r.text)
print("-" * 40)
r.close()

I don't understand why it wouldn't work when it clearly can ping google and even poll adafruit for their ip address. Any help appreciated.

justmobilize commented 1 month ago

firmware ver. 1.2.2 will have really old certs. Can you please update to the most recent version - instructions here and try again?

dhalbert commented 1 month ago

Also, did you change TEXT_URL, and if so, what is the new one?

sam-k0 commented 1 month ago

Also, did you change TEXT_URL, and if so, what is the new one?

Nope, no change from the tutorial, using the adafruit wifi test url. But I'm currently trying to update the esp firmware, maybe that will solve it :+1:

sam-k0 commented 1 month ago

firmware ver. 1.2.2 will have really old certs. Can you please update to the most recent version - instructions here and try again?

I just updated the firmware to 1.7.7, and unfortunately the error (timeout) persists. Edit: I turned on the esp._debug and this is the output:

Ping google.com: 10 ms
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
*** Get host by name
*** Get socket
Allocated socket #0
*** Socket connect mode 0
*** Open socket to bytearray(b'4\xcf\xdb\x88') 80 0
Writing: b'GET'
Writing: b' /'
Writing: b'testwifi/index.html'
Writing: b' HTTP/1.1\r\n'
Writing: b'Host'
Writing: b': '
Writing: b'wifitest.adafruit.com'
Writing: b'\r\n'
Writing: b'User-Agent'
Writing: b': '
Writing: b'Adafruit CircuitPython'
Writing: b'\r\n'
Writing: b'\r\n'
ESPSocket: 0 bytes available
ESPSocket: 0 bytes available
ESPSocket: 0 bytes available
ESPSocket: 0 bytes available
ESPSocket: 0 bytes available
...(continues with that)