0

I'm having a problem trying to make a get request in a specific site using python.

My code:

import requests

url = 'https://www.beneficiossociais.caixa.gov.br/consulta/beneficio/04.01.00-00_00.asp'
r = requests.get(url, verify=False)

The error:

SSLError: HTTPSConnectionPool(host='www.beneficiossociais.caixa.gov.br', port=443): Max retries exceeded with url: /consulta/beneficio/04.01.00-00_00.asp (Caused by SSLError(SSLError("bad handshake: SysCallError(-1, 'Unexpected EOF')")))

SrSonic
  • 1
  • 1

1 Answers1

0

The server you are trying to reach is practically broken. Apart from supporting long obsolete and insecure SSL 2 and SSL 3 and only supporting TLS 1.0 as kind of secure enough protocol version it only supports ciphers which are considered insecure or weak. Since these ciphers are disabled in Python and sometimes not even compiled into current OpenSSL versions (i.e. cannot be enabled with hacks like this) any TLS handshake with this broken server fails. Ignoring certificate errors as you do will not help since it is not a certificate problem which causes the handshake to fail but the lack of shared ciphers. For more see the SSLLabs report of this site.

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • So is there no way to make requests to this site? – SrSonic Mar 31 '20 at 06:29
  • @SrSonic: Not with the typical recent builds of OpenSSL which have 3DES and RC4 explicitly disabled at compile time. See the link in my answer for the workaround which works for older builds or if you explicitly build OpenSSL with these weak/insecure ciphers enabled. – Steffen Ullrich Mar 31 '20 at 06:39