美文网首页
python ssl错误proxy错误解决思路

python ssl错误proxy错误解决思路

作者: 吉凶以情迁 | 来源:发表于2023-04-10 13:38 被阅读0次

requests.exceptions.SSLError: HTTPSConnectionPool(host='explorer.api.openai.com', port=443): Max retries exceeded with url: /api/auth/csrf (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:997)')))

pip install --upgrade requests

    requests.packages.urllib3.disable_warnings()
        requests.adapters.DEFAULT_RETRIES = 30  # 增加重连次数
  response = self.session.get(
            url=url,
            headers=headers,
            timeout=(55, 55),
            verify=False
        )
 self.session = requests.Session()
        self.session.keep_alive = False  # 关闭多余连接
import requests

# 禁用 SSL 验证
requests.packages.urllib3.disable_warnings()

response = requests.get("https://explorer.api.openai.com", verify=False)
print(response.text)

Cannot connect to proxy.'问题

import requests

proxies = {
  "http": "http://yourproxyaddress:port",
  "https": "http://yourproxyaddress:port",
}

try:
  response = requests.get("https://www.example.com", proxies=proxies)
  print(response.text)
except requests.exceptions.ProxyError as e:
  print(e)

(Caused by ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))
降级版本
pip install urllib3==1.25.11

相关文章

网友评论

      本文标题:python ssl错误proxy错误解决思路

      本文链接:https://www.haomeiwen.com/subject/wfbbkdtx.html