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.
-
@devang-sharma
which firmware version?os.uname() -
@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') -
@livius, I've tried doing it without SSL and it works. But there is still an issue with using SSL.
-
@devang-sharma have you found a fix in the meanwhile for the -32512 error?
I'm running into this error too now. -
@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.
-
Try using gc after each request
gc.collect() -
@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
mbedtlsand 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
-
@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 Try closing the socket after each request you make as @this-wiederkehr suggested here. It worked for me.
-
Same problem happened to me. @ahmedkalnaggar solution solved, memory is not being freed properly.
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