I am trying to do a simple GET request to this url: link
Here's the basic python code which I already use for other urls and works.
url = 'http://www.bbvafrances.com.ar/francesGo2-Portal/institucional/busqueda.do?m=&page=1'
r = requests.get(url)
print r.text
The thing is that with this particular url I get an SSL error:
Traceback (most recent call last):
File "frances.py", line 134, in <module>
r = requests.get(url,verify=False)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 55, in get
return request('get', url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 335, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 454, in send
history = [resp for resp in gen] if allow_redirects else []
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 144, in resolve_redirects
allow_redirects=False,
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 438, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 331, in send
raise SSLError(e)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac
Any ideas on what is going on with this particular url that makes the request crash? I tried adding custom headers but still no luck.
Thanks in advance.
EDIT: Now I'm trying with this SSL way suggested as an answer.
url = 'https://www.bbvafrances.com.ar/francesGo2-Portal/institucional/busqueda.do?m=&page=1'
s = requests.Session()
s.mount(url, SSLAdapter(ssl.PROTOCOL_SSLv3))
r = s.get(url)
print r.text
This is the new trace: (almost identical to the first one)
Traceback (most recent call last):
File "frances.py", line 138, in <module>
r = s.get(url)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 463, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 451, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 557, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 420, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:1408F119:SSL routines:SSL3_GET_RECORD:decryption failed or bad record mac