![](/img/trans.png)
[英]Docker - Elasticsearch - Failed to establish a new connection: [Errno 111] Connection refused',))
[英]Requests - Python - Failed to establish a new connection: [Errno 111] Connection refused
我有一台在 Ubuntu 操作系統中運行的服務器,我正在使用 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)
這顯示了一個錯誤 -
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'))
當我打印變量req
以檢查狀態時,但 python 顯示變量未定義
這個怎么解決,謝謝
HTTPSConnectionPool(host='127.0.0.1', port=443)
443 是 HTTPS 的默認端口。
您可能(我們看不到您如何定義url
,但這是我最好的猜測)嘗試https://127.0.0.1/...
,而不是https://127.0.0.1:7001/...
– 在您的代碼中修復它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.