使用requests时SSLERROR

使用requests时SSLERROR
pycharm异常提示

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 <module>
    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就不会有这个问题。

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值