[英]Curl to requests; max retries exceeded
I've seen this: python requests equivalent to curl -H 我已经看到了: python请求等同于curl -H
but when I try and make my own python request I get the "Max retries exceeded with url:" error. 但是,当我尝试发出自己的python请求时,出现“ URL超出最大重试次数:”错误。
I am trying to convert this command 我正在尝试转换此命令
curl.exe -H "x-api-key: aORMdWt3AX90YewgsRfYM7Y77eUQws8M75Mb8TIF" https://cqh77pglf1.executeapi.uswest2.amazonaws.com/prod/data/location/71.1043443253471,42.3150676015829/time/20091225
into 进入
import requests
headers = {"x-api-key": "aORMdWt3AX90YewgsRfYM7Y77eUQws8M75Mb8TIF"}
r = requests.post('https://cqh77pglf1.executeapi.uswest2.amazonaws.com/prod/data/location/71.1043443253471,42.3150676015829/time/20091225', headers=headers)
(I've tried get as well) (我也尝试过)
Any help? 有什么帮助吗? Thanks in advance!
提前致谢!
尝试使用requests.get
而不是requests.post
,该curl命令可能正在调用GET而不是POST。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.