簡體   English   中英

如果從我的生產服務器向其他生產服務器發出 httprequest,則會出現連接錯誤,但它是通過 localhost 完成的

[英]Getting connection error if made httprequest from my production server to other production server , but its done with localhost

ConnectionError: HTTPSConnectionPool(host='remoteapiserver', port=443): Max retries exceeded with url: /api/post (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7feb54060bd0>: Failed to establish a new connection: [Errno 110]Connection timed out',))

代碼 :

import requests
import json

url :"https://remoteapiserver.com/api/post"

headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

datas = {"foo":"bar"}

r = requests.post(url,data=json.dumps(datas),headers=headers)

隱藏網址和域名

POSTGET都收到相同的錯誤。

請更新您的url值。 python 語法和URL格式有問題。 它應該是<protocol>://<server>/<context path>/<type>/<path> ,請查看此鏈接以獲取有關URL格式的更多信息。

url = 'https://www.remoteapiserver.com'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM