现有curl请求如:
curl -H 'Host: game.vrupup.com' -H 'Sec-Fetch-Mode: cors' -H 'Origin: https://game.vrupup.com' -H 'User-Agent: Mozilla/5.0 (Linux; Android 10; Mi 10 Build/QKQ1.191117.002; wv) AppleWebKit/5owser/6.2 TBS/045332 Mobile Safari/537.36 MMWEBID/9597 MicroMessenger/7.0.16.1700(0x27001034) Process/tools WeChat/arm32 NetType/WIFI Language/zh_CN ABI/arm64' -H 'Accept: */*' -H 'X-Requested-With: com.tencent.mm' -H 'Sec-Fetch-Site: same-origin' -H 'Referer: https://game.vrupup.com/resources/game/sh_game/2020/mtH5/main.html?date=1601089278182' -H 'Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7' -H 'Cookie: PHPSESSID=jtn9lgtl1in6pseknqsr4uk0vo' --data "¶m=60e9a3cdca091e9223af20939193453b" --compressed 'https://game.vrupup.com/sanguo/zhangkai/h5/zk_maotai/public/api/api/game_count'
转python代码 1.网站转化 https://zhexuany.github.io/curl-to-py/ 2.手动
转化结果
import requests
headers = {
'Host': 'game.vrupup.com',
'Sec-Fetch-Mode': 'cors',
'Origin': 'https://game.vrupup.com',
'User-Agent': 'Mozilla/5.0 (Linux; Android 10; Mi 10 Build/QKQ1.191117.002; wv) AppleWebKit/5owser/6.2 TBS/045332 Mobile Safari/537.36 MMWEBID/9597 MicroMessenger/7.0.16.1700(0x27001034) Process/tools WeChat/arm32 NetType/WIFI Language/zh_CN ABI/arm64',
'Accept': '*/*',
'X-Requested-With': 'com.tencent.mm',
'Sec-Fetch-Site': 'same-origin',
'Referer': 'https://game.vrupup.com/resources/game/sh_game/2020/mtH5/main.html?date=1601089278182',
'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
'Cookie': 'PHPSESSID=jtn9lgtl1in6pseknqsr4uk0vo',
}
data = [
('param', '60e9a3cdca091e9223af20939193453b'),
]
r = requests.post('https://game.vrupup.com/sanguo/zhangkai/h5/zk_maotai/public/api/api/game_count', headers=headers,
data=data)
print(r.text)