urequests error: OSError: -202

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
hsmptg
Posts: 4
Joined: Tue Nov 26, 2019 5:12 pm

urequests error: OSError: -202

Post by hsmptg » Tue May 24, 2022 6:55 pm

Hi
On a program that makes a GET request from api.openweathermap.org I am very often (but not always) getting the following error when using urequests.py:

Code: Select all

Connecting to network...
......... Connected!
network config: ('10.0.5.187', '255.255.255.0', '10.0.5.1', '10.0.5.1')
Traceback (most recent call last):
  File "main.py", line 29, in <module>
  File "urequests.py", line 116, in get
  File "urequests.py", line 55, in request
OSError: -202
MicroPython v1.18 on 2022-01-17; ESP32 module with ESP32
Type "help()" for more information.
>>> 
This is strange because the same code on the Wokwi simulator works always like a charm: https://wokwi.com/projects/332541527611933267
Any tip for this behaviour?

By the way, that line 55 of urequests.py I find this:

Code: Select all

ai = usocket.getaddrinfo(host, port, 0, usocket.SOCK_STREAM)

ChrisO
Posts: 48
Joined: Mon Apr 06, 2020 6:16 pm

Re: urequests error: OSError: -202

Post by ChrisO » Wed May 25, 2022 5:50 am

Are you sure your gateway, 10.0.5.1 works as a DNS server as well? You might have more success with a public dns server. Try looking up how to configure a static IP (with ifconfig) to configure another dns
Chris

Post Reply