LoPy HTTP POST request: OSError!
-
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: -32512This is the line in which I'm having this error:
s = ssl.wrap_socket(s, server_hostname=host)
How can it be solved?
Thanks.
-
Same problem happened to me. @ahmedkalnaggar solution solved, memory is not being freed properly.
-
@RobTuDelft Try closing the socket after each request you make as @this-wiederkehr suggested here. It worked for me.
-
@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?
-
@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 is0x7f00
- 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.
- translate the number without the sign to hex
-
Try using gc after each request
gc.collect()
-
@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.
-
@devang-sharma have you found a fix in the meanwhile for the -32512 error?
I'm running into this error too now.
-
@livius, I've tried doing it without SSL and it works. But there is still an issue with using SSL.
-
@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')
-
@devang-sharma
which firmware version?os.uname()