8000 esp32 esp8266 urequests · Issue #8251 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

esp32 esp8266 urequests #8251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
9avel opened this issue Feb 2, 2022 · 6 comments
Closed

esp32 esp8266 urequests #8251

9avel opened this issue Feb 2, 2022 · 6 comments

Comments

@9avel
Copy link
9avel commented Feb 2, 2022

Hi. please tell me the urequests library, is it different for esp32 and esp8266? for esp32 it works with both http and https, and for esp8266 only http, with https error OSError 40, has anyone encountered this phenomenon? Thank you

@dpgeorge
Copy link
Member
dpgeorge commented Feb 2, 2022

is it different for esp32 and esp8266?

It is the same.

for esp8266 only http, with https error OSError 40

Can you provide a minimal example that has this error on esp8266?

@9avel
Copy link
Author
9avel commented Feb 3, 2022

This is the actual code I am using.
If http, everything works fine, https immediately error.
Maybe I'm doing something wrong?
Thanks for the help.

from machine import Pin
import dht
from urequests import post
import json



def dth11_data(url, token):
    sensor = dht.DHT11(Pin(14))
    sensor.measure()
    d = {
        "temperature": int(sensor.temperature()),
        "humidity": int(sensor.humidity())
    }
    data = json.dumps(d)

    response = post(url, data=data, headers={'Content-Type': 'application/json',
                                  'Authorization': token})
    response.close()

@maskmly
Copy link
maskmly commented Feb 4, 2022

I have a similar problem with urequests.get(url) function on ESP32!
If I pass a url that is not HTTPS then I can get the file. However, when I pass a url with HTTPS I get the following error:

>>> myFile = urequests.get('https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "urequests.py", line 116, in get
  File "urequests.py", line 62, in request
OSError: [Errno 12] ENOMEM
>>>

@Fr3nky88
Copy link

I'm following because i have the same problem with HTTPS, i fleshed the last firmware on the esp32 but still have the problem.

@maskmly
Copy link
maskmly commented Apr 8, 2022

I have a similar problem with urequests.get(url) function on ESP32!
If I pass a url that is not HTTPS then I can get the file. However, when I pass a url with HTTPS I get the following error:

I found a workaround for this problem. Instead of using urequests.get(url) I used urequests.request('GET', url).
This solved the problem with downloading from HTTPS urls.

@jimmo
Copy link
Member
jimmo commented Jul 21, 2022

This issue is now being tracked in #8940.

@jimmo jimmo closed this as completed Jul 21, 2022
tannewt added a commit to tannewt/circuitpython that referenced this issue Aug 2, 2023
Fixed Trailing White Space - Changed SPI and LED Pin Assignments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0