[英]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.