2015-07-23 13 views
13

In Python, auf einem Ubuntu-Server, Ich versuche, die requests Bibliothek zu bekommen, um HTTPS-Anfragen zu machen, etwa so:Attribute: '_socketobject' Objekt hat kein Attribut 'set_tlsext_host_name'

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

Zuerst habe ich bekam die folgenden:

/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 .

nach dem Rat in dieser Frage folgenden: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately, ich habe jetzt meine Warnung an den folgenden Fehler aktualisiert:

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

Wie behebe ich das?

Antwort

13

Das Update für mich war die folgende:

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

ich brauchte, um 'sudo apt-get install libffi-dev' vor pyopenssl – laffuste

3

Diese Lage war für mich die Python arbeiten Ubuntu 12.04.3 LTS zu bekommen.

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

Dank der Installation. In meinem Fall war es nötig, Pip zu aktualisieren. –

2

Auf RedHat:

sudo yum remove pyOpenSSL 
sudo pip install pyopenssl 
Verwandte Themen