[英]Requests - Python - Failed to establish a new connection: [Errno 111] Connection refused
I have a server running in Ubuntu OS, and I am using Python for getting to learn.我有一台在 Ubuntu 操作系统中运行的服务器,我正在使用 Python 来学习。
I started an app which I installed, When I opened the app in browser the page is not secure, like this -我启动了一个我安装的应用程序,当我在浏览器中打开应用程序时,页面不安全,就像这样 -
I am getting some data from this page using python -我正在使用 python 从这个页面获取一些数据 -
from urllib3.exceptions import InsecureRequestWarning
import requests
requests.urllib3.disable_warnings(category=InsecureRequestWarning)
req = requests.get(url='https://127.0.0.1:7001', verify=False)
This shows an error -这显示了一个错误 -
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='127.0.0.1', port=7001): Max retries exceeded with url: / (Caused by
NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fc2ae5f94f0>: Failed to establish a new connection: [Errno 111] Connection refused'))
When I print the variable req
to check the status, but python shows the variable is not defined当我打印变量
req
以检查状态时,但 python 显示变量未定义
How to solve this, thanks这个怎么解决,谢谢
HTTPSConnectionPool(host='127.0.0.1', port=443)
HTTPSConnectionPool(host='127.0.0.1', port=443)
443 is the default port for HTTPS. 443 是 HTTPS 的默认端口。
You're probably (we can't see how you've defined url
, but that's my best guess) trying https://127.0.0.1/...
, not https://127.0.0.1:7001/...
– fix that in your code.您可能(我们看不到您如何定义
url
,但这是我最好的猜测)尝试https://127.0.0.1/...
,而不是https://127.0.0.1:7001/...
– 在您的代码中修复它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.