Skip to content

MicroWebSrv2 with urequests -- Wont' resolve FQDN while MicroWebSrv2 is running #93

@interconnectix

Description

@interconnectix

I am running Micropython 1.20 on a ESP32-WROOM microcontroller with MiroWebSrv2 and urequests.

When MicroWebSrv2 is running (mws2.StartManaged()) I cannot use urequests to POST JSON to a FQDN domain. It will return an error of OSError(16,)

Code example below:


import urequests
def sendInfo():
data = {
"key:vaule"
}
try:
response = urequests.post(http://somedomain.com/data/api, json=data)
print("Response status code:", response.status_code)
print("Response content:", response.content)
except Exception as e:
print("Error occurred during the request:")
print(repr(e))

If I replace the FQDN domain with a IP address (random example IP below), it works as expected while MicroWebSrv2 is running. (mws2.StartManaged())


import urequests
def sendInfo():
data = {
"key:vaule"
}
try:
response = urequests.post(http://8.8.8.8/data/api, json=data)
print("Response status code:", response.status_code)
print("Response content:", response.content)
except Exception as e:
print("Error occurred during the request:")
print(repr(e))

Any suggestions on a resolution as it seems that it won't resolve DNS. (note: when I stop MicroWebSrv2 (mws2.Stop()), urequests can resolve a FQDN.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions