python-requests 2.0.0 - [Errno 8] _ssl.c:504: EOF occurred in violation of protocol

前端 未结 1 733
故里飘歌
故里飘歌 2021-02-10 11:04

I\'m using Requests 2.0.0 and failed to complete https GET request using:

requests.get(\'https://backend.iddiction.com/rest/v1/s2s/confirm_install?apphandle=slot         


        
1条回答
  •  孤城傲影
    2021-02-10 11:48

    The server requires that you use SNI, which isn't normally available in Python 2.x.

    If you open that URL in a browser and use Wireshark to trace out the TLS handshake, you can see that Chrome proposes the server name and that the remote server uses it to determine which certificate to use.

    To make this work in Requests you can either use Python 3, which includes SNI support and which Requests will transparently make use of, or you can install the required dependencies for SNI in Python 2.x in Requests from this answer:

    • pyopenssl
    • ndg-httpsclient
    • pyasn1

    Either of those solutions will make your code work correctly.

    0 讨论(0)
提交回复
热议问题