SSL Connection IPProto_SEC Error SiPy



  • Re: SSL connection IPProto_SEC error

    Been trying to get this lib to work: https://github.com/Enabling/wipy-urllib/tree/master

    But I get the same error as in the older forum entry:

    AttributeError: 'module' object has no attribute 'IPPROTO_SEC'
    

    And as fare as I can read on the Git the code below is only for the WiPy 1

    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_SEC)
    

    Any idea how to re-write the library to take this into account? Am using an SiPy.



  • @livius Did a quick try. Got the following error:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/flash/lib/urequests.py", line 141, in urlopen
      File "/flash/lib/urequests.py", line 38, in __init__
    OSError: -32512
    

    Will look more into it later, but as fare as I can Google it might have something to do with the antenna transmission.



  • @Lokefar
    instead of:

    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_SEC)
                sock.settimeout(5)
                s = ssl.wrap_socket(sock)
    s.connect(socket.getaddrinfo(host, port)[0][4])
    

    do (not tested but should be something simmilar)

    sock = socket.socket()
    s = ssl.wrap_socket(sock)
    s.connect(socket.getaddrinfo(host, port)[0][-1])
    


  • @livius Thanks. I was already having a look at that but my initial thought is that it is a bit beyond my comprehension ability to convert it.



  • @Lokefar
    you can wrap socket by ssl
    https://docs.pycom.io/pycom_esp32/library/ussl.html?highlight=ssl

    this is good start point for conversion


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.