Python 2.7 Python请求错误。没有可用的密码
我尝试使用requests.get已有一段时间了,但我一直遇到这个错误Python 2.7 Python请求错误。没有可用的密码,python-2.7,python-requests,Python 2.7,Python Requests,我尝试使用requests.get已有一段时间了,但我一直遇到这个错误 HTTPSConnectionPool(host='google.com', port=443): Max retries exceeded with url: / (Caused by SSLError( SSLError("bad handshake: Error([('SSL routines', 'ssl_cipher_list_to_bytes', 'no ciphers available')],)
HTTPSConnectionPool(host='google.com', port=443):
Max retries exceeded with url:
/ (Caused by SSLError(
SSLError("bad handshake: Error([('SSL routines',
'ssl_cipher_list_to_bytes', 'no ciphers available')],)",),))
这是我的密码
import ssl
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import
PoolManager
from requests.packages.urllib3.util import ssl_
CIPHERS = ( 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-
ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AElS256-
SHA384: ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-
AES128-GCM-SHA256:ECDHE-RSA-AES128-
SHA256:AES256-SHA' )
class TlsAdapter(HTTPAdapter):
def __init__(self, ssl_options=0, **kwargs):
self.ssl_options = ssl_options
super(TlsAdapter, self).__init__(**kwargs)
def init_poolmanager(self, *pool_args, **pool_kwargs):
ctx = ssl_.create_urllib3_context(ciphers=CIPHERS,
cert_reqs=ssl.CERT_REQUIRED,
options=self.ssl_options)
self.poolmanager = PoolManager(*pool_args,
ssl_context=ctx, **pool_kwargs)
s = requests.session()
adapter = TlsAdapter()
s.mount("https://", adapter)
try:
r = s.get('https://google.com')
print(r)
except Exception as e:
print(e)
有人知道这里出了什么问题吗?我认为这会非常有效