Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    LoPy HTTP POST request: OSError!

    Scheduled Pinned Locked Moved LoPy
    http postoserrorssllopyurequest.py
    11 Posts 6 Posters 3.0k Views 7 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      Devang Sharma
      last edited by Devang Sharma

      Hello, I'm using LoPy and I was trying to send data to my variables at ubidots web server which has HTTPS protocol. I am using urequests.py library.

      But I am getting below error:

      File "main.py", line 24, in <module>
      File "/flash/lib/urequest.py", line 96, in request
      File "/flash/lib/urequest.py", line 60, in request
      OSError: -32512

      This is the line in which I'm having this error:

      s = ssl.wrap_socket(s, server_hostname=host)

      How can it be solved?

      Thanks.

      L 1 Reply Last reply Reply Quote 0
      • L Offline
        livius @Devang Sharma
        last edited by

        @devang-sharma
        which firmware version?

        os.uname()
        

        think about people first, then computers

        1 Reply Last reply Reply Quote 0
        • D Offline
          Devang Sharma
          last edited by

          @livius, I've recently updated the firmware.

          os.uname()
          (sysname='LoPy', nodename='LoPy', release='1.10.1.b1', version='v1.8.6-839-g536c958c on 2017-11-15', machine='LoPy withESP32', lorawan='1.0.0')

          1 Reply Last reply Reply Quote 0
          • D Offline
            Devang Sharma
            last edited by

            @livius, I've tried doing it without SSL and it works. But there is still an issue with using SSL.

            RobTuDelftR 1 Reply Last reply Reply Quote 0
            • RobTuDelftR Offline
              RobTuDelft @Devang Sharma
              last edited by

              @devang-sharma have you found a fix in the meanwhile for the -32512 error?
              I'm running into this error too now.

              Without data you're just another person with an opinion.
              Hackster | About me

              D 1 Reply Last reply Reply Quote 0
              • D Offline
                Devang Sharma @RobTuDelft
                last edited by

                @robtudelft Not yet. But till then what you could do is use the IP address instead of DNS which can be written as HTTP and it will work perfectly fine. It's the secondary thing if you require secure establishment. But this issue should be taken into consideration.

                1 Reply Last reply Reply Quote 0
                • A Offline
                  ahmedkalnaggar
                  last edited by

                  Try using gc after each request
                  gc.collect()

                  V 1 Reply Last reply Reply Quote 1
                  • T Offline
                    this.wiederkehr
                    last edited by

                    @robtudelft said in LoPy HTTP POST request: OSError!:

                    have you found a fix in the meanwhile for the -32512 error?

                    Whenever you get os errors with strange numbers which might be related to sockets and tls you have to do:

                    • translate the number without the sign to hex hex(32512) which is 0x7f00
                    • search for mbedtls and that number. google will come up with https://tls.mbed.org/api/ssl_8h.html
                    • on that page you'll find the reason for the error:
                    #define MBEDTLS_ERR_SSL_ALLOC_FAILED   -0x7F00
                    Memory allocation failed.
                    
                    RobTuDelftR 1 Reply Last reply Reply Quote 2
                    • RobTuDelftR Offline
                      RobTuDelft @this.wiederkehr
                      last edited by

                      @this-wiederkehr Thanks, that is very useful. For now I'll just go with the solution of @Devang-Sharma. Any idea why this error might pop up?

                      Without data you're just another person with an opinion.
                      Hackster | About me

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        Devang Sharma
                        last edited by

                        @RobTuDelft Try closing the socket after each request you make as @this-wiederkehr suggested here. It worked for me.

                        1 Reply Last reply Reply Quote 1
                        • V Offline
                          Valentin Pedrosa @ahmedkalnaggar
                          last edited by

                          Same problem happened to me. @ahmedkalnaggar solution solved, memory is not being freed properly.

                          1 Reply Last reply Reply Quote 0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 1 / 1
                          • First post
                            Last post

                          Pycom on Twitter

                          Pycom