Skip to main content
1 de 2

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

Olá, estou executando um simples código python (2.7.3) para lançar uma mensagem por webhook no Discord e estou encontrando o seguinte erro:

  • 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*

O código que está sendo executado é esse:

from urllib import urlopen

url = 'https://minhaurl.com/webhook.php'

urlopen(url).read()

Obs: Não há erro no arquivo PHP porque usei ele antes. Alguém poderia me ajudar?