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',))
code :
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)
hidden the url and domain
both POST
and GET
are getting same error.
Please update your url
value. Something wrong with the python syntax and the formatting of your URL
. It should be <protocol>://<server>/<context path>/<type>/<path>
, please check this link for further more about URL
formatting.
url = 'https://www.remoteapiserver.com'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.