Ioerror: [Errno socket error] [Errno 8] _ssl. c:504: EOF occurred in Violation of Protocol

Asked

Viewed 37 times

0

Hello, I am running a simple python code (2.7.3) to launch a webhook message on Discord and am encountering the following error:

  urlopen(url).read()

  File "C:\Python27\lib\urllib.py", line 86, in urlopen
    return opener.open(url)
  File "C:\Python27\lib\urllib.py", line 207, in open
    return getattr(self, name)(url)
  File "C:\Python27\lib\urllib.py", line 436, in open_https
    h.endheaders(data)
  File "C:\Python27\lib\httplib.py", line 954, in endheaders
    self._send_output(message_body)
  File "C:\Python27\lib\httplib.py", line 814, in _send_output
    self.send(msg)
  File "C:\Python27\lib\httplib.py", line 776, in send
    self.connect()
  File "C:\Python27\lib\httplib.py", line 1161, in connect
    self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
  File "C:\Python27\lib\ssl.py", line 381, in wrap_socket
    ciphers=ciphers)
  File "C:\Python27\lib\ssl.py", line 143, in __init__
    self.do_handshake()
  File "C:\Python27\lib\ssl.py", line 305, in do_handshake
    self._sslobj.do_handshake()

IOError: [Errno socket error] [Errno 8] _ssl.c:504: EOF occurred in violation of protocol

The code that is running is this:

from urllib import urlopen
url = 'https://minhaurl.com/webhook.php'
urlopen(url).read()

Note: There is no error in PHP file because I used it before. Could someone help me?

1 answer

0


The problem is you’re trying to use https and not http, and for that, you need several encryption libs installed and updated. python 2.7.3 is elder (was released more than 6 years ago) and much has changed in this field since it was launched.

Encryption technology (ssl) has been updated several times during this period. Try updating your python to the newer version. If you have pyOpenSSL, update it as well.

  • Thank you, I didn’t realize it before.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.