![](/img/trans.png)
[英]My fastapi app getting crushed on production server but also working on 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)
隱藏網址和域名
POST
和GET
都收到相同的錯誤。
請更新您的url
值。 python 語法和URL
格式有問題。 它應該是<protocol>://<server>/<context path>/<type>/<path>
,請查看此鏈接以獲取有關URL
格式的更多信息。
url = 'https://www.remoteapiserver.com'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.