此代码返回500状态代码。当我用“groupLink”替换type时,它适用于组链接,但是当我尝试缩写时它不会
import requests
headers = {
"Content-Type":"application/x-www-form-urlencoded",
"User-Agent": "Firefox",
"Host": "#.com",
"Content-Length":"39"
}
payload = {
"xml":"1",
"type":"abbreviation",
"value":"stackover"
}
r = requests.post("http://#.com/actions/AvailabilityCheck/", headers=headers, data=payload)
print(r)
答案 0 :(得分:1)
在Cookie中检查您的会话。
import requests
headers = {
'Content-Type': 'text/plain;charset=UTF-8',
'Cookie': 'sessionid=6a3a05dsd29709707c27991f; steamCountry=KR%7C01d0fa93544aeb0f7d0de4fc244d8b25',
}
payload = {
"xml":"1",
"type":"abbreviation",
"value":"stackover"
}
r = requests.post("http://steamcommunity.com/actions/AvailabilityCheck/", headers=headers, data=payload)
print(r.text)
此代码打印<?xml version="1.0" encoding="UTF-8" standalone="yes"?><response><results><![CDATA[Missing Data]]></results></response>
答案 1 :(得分:0)
试试这个
import requests
import json
headers = {
"Content-Type":"application/x-www-form-urlencoded",
"User-Agent": "Firefox",
"Host": "steamcommunity.com",
"Content-Length":"39"
}
payload = {
"xml":"1",
"type":"groupLink",
"value":"stackover"
}
r = requests.post("http://steamcommunity.com/actions/AvailabilityCheck/", headers=headers, data=json.dumps(payload))
print(r)