如何在python 2.7.3中使用TLS1.1

如何在python 2.7.3中使用TLS1.1,python,ssl,Python,Ssl,我的服务器中有python 2.7.3,我想使用TLS1.1[python 2.7.3只支持TLS1.0] 我无法升级python版本,因为它会影响其他版本。 我尝试使用Backport,但它给出了错误 这是我的密码 import backports.ssl as ssl import requests def do_it(): with requests.Session() as s: s.mount('https://', MyAdapter())

我的服务器中有python 2.7.3,我想使用TLS1.1[python 2.7.3只支持TLS1.0]

我无法升级python版本,因为它会影响其他版本。 我尝试使用Backport,但它给出了错误

这是我的密码

import backports.ssl as ssl
import requests

def do_it():  
    with requests.Session() as s:
        s.mount('https://', MyAdapter())
        url = 'https://ap4.salesforce.com/services/data/v35.0/sobjects'
        response = s.get(url,headers=_headers)
        response = requests.get(url,headers=_headers)

if __name__ == '__main__':
    do_it()

您能描述一下您在使用Backport时遇到的错误吗?我遇到了以下错误:home/ubuntu/netskope/service/nsenv/local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.pyc在ssl_-wrap_-socket(sock,keyfile,certfile,cert_-reqs,ca_-certs,server_-hostname,ssl_-version)中253 ca_-certs=None,服务器\u主机名=无,254 ssl\u版本=无):-->255 ctx=OpenSSL.ssl.Context(\u OpenSSL\u版本[ssl\u版本])256如果certfile:257 keyfile=keyfile或certfile#匹配正常python ssl库KeyError:5的行为,那么问题不太可能不是python本身的版本,而是底层OpenSSL库的版本。对于TLS 1.1和TLS 1.2,需要支持OpenSSL 1.0.1,如果您仍然坚持使用OpenSSL 1.0.0或0.9.8,则后台端口将不会有帮助(请检查
python-c“导入ssl;打印ssl.OpenSSL\u版本”
)。但是您可以尝试并行安装另一个Python,以便其他人可以在您使用新版本时继续使用旧版本。