使用requests时SSLERROR

使用requests时SSLERROR
使用requests时SSLERROR_第1张图片

Traceback (most recent call last):
  File "E:\Anaconda\lib\site-packages\urllib3\connectionpool.py", line 588, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "E:\Anaconda\lib\site-packages\urllib3\connectionpool.py", line 248, in _get_conn
    return conn or self._new_conn()
  File "E:\Anaconda\lib\site-packages\urllib3\connectionpool.py", line 816, in _new_conn
    raise SSLError("Can't connect to HTTPS URL because the SSL "
urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Anaconda\lib\site-packages\requests\adapters.py", line 449, in send
    timeout=timeout
  File "E:\Anaconda\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "E:\Anaconda\lib\site-packages\urllib3\util\retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /search/repositories?q=language:python&sort=stars (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/pythoncode/learn/0222.py", line 5, in 
    r=requests.get(url)
  File "E:\Anaconda\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "E:\Anaconda\lib\site-packages\requests\api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "E:\Anaconda\lib\site-packages\requests\sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "E:\Anaconda\lib\site-packages\requests\sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "E:\Anaconda\lib\site-packages\requests\adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /search/repositories?q=language:python&sort=stars (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))

SSLERROR

如果你在第一次使用requests时出现SSL错误:SSLError("Can’t connect to HTTPS URL because the SSL " urllib3.exceptions.SS,如果你是用的anaconda版的python,那么只要装python原版就好了,百度了好多资料,在CSDN上看了好多解决办法,都不行,包括设置SSL验证为False等等,最后在StackOverflow上查到了一个,原帖附上
点这个进原帖
大致就是说anaconda版的python是用的anaconda自己的SSL库,所以会报错,换回原版python就不会有这个问题。

你可能感兴趣的:(learn,py)