Модуль chembl_webresource_client.new_client
(версия 0.8.5), доступный от pypi, представляет собой базу данных client for accessing the new web service API of the ChEMBL. Он использует urllib3
, который является broken for a while в python 2.7.9, из-за недостающего sslwrap
во встроенном модуле ssl
. Если я пытаюсь импортировать модуль:Модуль chembl_webresource_client.new_client не работает, поскольку сломанный ssl в urllib3 под python 2.7.9
from chembl_webresource_client.new_client import new_client
Трассировка стека выглядит следующим образом:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/chembl_webresource_client/new_client.py", line 63, in <module>
new_client = client_from_url(Settings.Instance().NEW_CLIENT_URL + '/spore')
File "/usr/lib/python2.7/site-packages/chembl_webresource_client/new_client.py", line 27, in client_from_url
res = requests.get(url)
File "/usr/lib/python2.7/site-packages/requests/api.py", line 65, in get
return request('get', url, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/api.py", line 49, in request
response = session.request(method=method, url=url, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 461, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 370, in send
timeout=timeout
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 341, in _make_request
self._validate_conn(conn)
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 762, in _validate_conn
conn.connect()
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connection.py", line 238, in connect
ssl_version=resolved_ssl_version)
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py", line 256, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python2.7/ssl.py", line 350, in wrap_socket
_context=self)
TypeError: __init__() got an unexpected keyword argument 'server_hostname'
Наконец-то я мог бы решить эту проблему, я буду размещать решение ниже.