我完全是API的新手,我很难连接到Marvel API。文件说,我的连接链接应该是这样的:连接到API,获得409返回
https://gateway.marvel.com:443/v1/public/characters?nameStartsWith=Spider&apikey=XXXXX&hash=XXXXXX
哈希是一个MD5的字符串从时间戳(或其他字符串,将改变每一个请求,私钥和公钥)方含
我注册了他们的网站上,我有我的钥匙,这就是我想作一个打电话找字谁的名字开头为“蜘蛛”
创建的每个请求樟宜NG字符串:
t ='{:%H:%M:%S}'.format(datetime.datetime.now()) t = t.replace(":", "")
输出: “213944”
散列:
m = hashlib.md5(t+private+public).hexdigest()
包我试图使用方法:
pack = 'https://gateway.marvel.com:443/v1/public/characters?nameStartsWith=Spider&apikey=<ACTUAL-API-KEY>&hash=' + m
请求打印响应:
response = requests.get(pack) print(response)
我不断收到回Response[409]
,并根据API文档就意味着我有错误的时间戳,公共或私人密钥。我花了几个小时已经试图找出什么是错的,我需要一些帮助。
This is a direct link to API documentation
非常感谢,得到回应200! – Viktor