Skip to content

esp32 esp8266 urequests #8251

Closed
Closed

Description

@9avel

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

Activity

  1. dpgeorge commented on Feb 2, 2022

    @dpgeorge
    Member

    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?

  2. 9avel commented on Feb 3, 2022

    @9avel
    Author

    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()
    
  3. maskmly commented on Feb 4, 2022

    @maskmly

    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
    >>>
    
  4. Fr3nky88 commented on Feb 28, 2022

    @Fr3nky88

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

  5. maskmly commented on Apr 8, 2022

    @maskmly

    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.

  6. jimmo commented on Jul 21, 2022

    @jimmo
    Member

    This issue is now being tracked in #8940.

  7. added a commit that references this issue on Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions