我正在尝试用python发出post请求。我已经在postman中测试了这个请求,它可以工作,但是当我尝试在python3.6脚本中运行它时,我得到了一个403 invalid token
错误。有什么我不知道的吗?你知道吗
邮递员给我的现行代码如下
import requests
url = "https://www.deviantart.com/dapi/v1/browse/thumbs"
querystring = {"iid":"598m980bb6e26e5be0a33d4a88ed1c570026-jshtsqc2-1.21","mp":"5"}
payload = ""
headers = {
'origin': "https://www.deviantart.com",
'user-agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36",
'content-type': "application/x-www-form-urlencoded",
'accept': "*/*",
'cache-control': "no-cache",
'postman-token': "cd95e1a8-2203-eaaf-91ee-4cf56ee41875"
}
response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
print(response.text)
这个请求可以在我的浏览器和postman应用程序中工作,但不能在python中工作
嗯,我发现了一些东西。我使用rssapi,这样就可以发送查询请求。所以嘿。如果行得通就行。你知道吗
相关问题 更多 >
编程相关推荐