2015-07-23 22 views
13

W Pythonie na serwerze Ubuntu, staram się dostać do biblioteki requests aby HTTPS, tak:AttributeError: „_socketobject” obiekt ma atrybut „set_tlsext_host_name”

import requests 
requests.post("https://example.com") 

Początkowo ja mam następujące:

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning .

Po wykonaniu rady w tej kwestii: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately, mam teraz zmodernizowane moje ostrzeżenie następującego błędu:

AttributeError: '_socketobject' object has no attribute 'set_tlsext_host_name'

Jak to naprawić?

Odpowiedz

13

Rozwiązaniem dla mnie było następujące:

sudo apt-get purge python-openssl 
sudo pip install pyopenssl 
+2

Musiałem 'sudo apt-get install libffi-dev' przed zainstalowaniem pyopenssl – laffuste

3

ten był w stanie uzyskać pytona pracuje na Ubuntu 12.04.3 LTS dla mnie.

sudo apt-get install python-dev python-pip build-essential libffi-dev 
sudo -H pip install --upgrade pip setuptools && sudo -H pip install --upgrade pyopenssl 
+0

Dzięki. W moim przypadku potrzebna była poprawa pip. –

2

Na RedHat:

sudo yum remove pyOpenSSL 
sudo pip install pyopenssl 
Powiązane problemy