繁体   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