gpt4 book ai didi

Python 无法连接到 HTTPS URL,因为 SSL 模块不可用 HTTPSConnectionPool(url, port=443)

转载 作者:行者123 更新时间:2023-12-04 22:39:51 27 4
gpt4 key购买 nike

我的 Python 代码:

import requests
from bs4 import BeautifulSoup

url = 'http://pythondojang.bitbucket.io/weather/observation/currentweather.html'
response = requests.get(url, verify=False)
soup= BeautifulSoup(response.content, 'html.parser')
print(soup)
错误信息:
HTTPSConnectionPool(host='pythondojang.bitbucket.io', port=443): Max retries exceeded with 
url: /weather/observation/currentweather.html (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:


During handling of the above exception, another exception occurred:

File "C:\work\python\practice\ReadHTML.py", line 5, in <module> (Current frame)
response = requests.get(url, verify=False)
完毕:
pip install requests --upgrade
pip install pyOpenSSL --upgrade
python version = 3.8.8
request version = 2.26.0
openssl version = 1.1.1k
pyopenssel version = 21.0.0
操作系统:窗口 10
我尝试在谷歌中进行多次搜索但失败了
谁能帮我解决这个错误?

最佳答案

问题是该站点不是“HTTPS”。
将网址更改为:

url = 'https://pythondoj........
PORT 443 唯一的工作端口安全 socket 。
告诉我它是否有用。
问候

关于Python 无法连接到 HTTPS URL,因为 SSL 模块不可用 HTTPSConnectionPool(url, port=443),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69847824/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com