0

I am using the request package as

url = 'https://jobregister.aas.org'
page = requests.get(url) 

but this leads to the following error

requests.exceptions.ConnectionError: 
HTTPSConnectionPool(host=url, port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)'),))

does anybody know what is causing this?

EDIT: I noticed that this error only happens with for the url above. Other urls don't show this issue?

carl
  • 3,322
  • 6
  • 32
  • 80
  • Which version of Python did you use to execute the snippet code above? – tebesfinwo Aug 29 '17 at 15:32
  • hi teb I used version >>> import sys >>> print (sys.version) 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] – carl Aug 29 '17 at 22:35
  • If its happening only with the above url, it may just be that the security layer of the web site does not accept older TLS versions. Very recently, Python.org sites also stopped supporting TLS versions 1.0 and 1.1 causing a lot of `pip install`s failing everywhere. See: https://stackoverflow.com/a/49748494/1526703 – Anupam Apr 16 '18 at 04:09

2 Answers2

0

I believe that your issue is that '/' does not want to establish communication with your Requests via TLS v1.0.

I did encounter identical exception a couple days ago when I was using Python2.7.10 and OpenSSL 1.0.2l on my local machine. This issue was resolved by upgrading to Python2.7.13. I haven't investigated in depth what is causation of Requests raising this exception yet.

tebesfinwo
  • 655
  • 1
  • 6
  • 18
0

In my case the server was configured with tls1.1 only. The solution was using SSLAdapter.

import requests, ssl
from requests_toolbelt import SSLAdapter

with requests.Session() as _sess:
    _sess.mount("https://", SSLAdapter(ssl.PROTOCOL_TLSv1_1))
    res = _sess.post(url_endpoint, **kwargs)