"apiVersion": 1.0,
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36",
"apiVersion": 1.0,
"Content-Type": "application/json;charset=UTF-8"
}
这是报错提示
InvalidHeader: Value for header {apiVersion: 1.0} must be of type str or bytes, not <class 'float'>
大佬们这样问题怎么处理,我试了str(1.0)服务器反馈签名错误
import requests
headers = {
'Connection': 'keep-alive',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
'sec-ch-ua': '"Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99"',
'Accept': 'application/json, text/plain, */*',
'apiVersion': '1.0',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36',
'Content-Type': 'application/json;charset=UTF-8',
'Origin': 'http://www.titanmatrix.com',
'Sec-Fetch-Site': 'cross-site',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'http://www.titanmatrix.com/',
'Accept-Language': 'zh-CN,zh;q=0.9',
}
data = '{"appid":"201010","client":{"system":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36","version":"1.0.0"},"param":{"serviceKey":"a4966e02741c4cc091fe1834d00f149c"},"timestamp":"2021/03/19 16:43:47","rank":"7624250140391473","sign":"747ed481b08624e23626afb9ed7ebfa5"}'
response = requests.post('https://cpq.titanmatrix.com/api/cpq/plugins/getpluginsinfo', headers=headers, data=data)
print(response.text)
要不你试试像这样把1.0放引号里
"apiVersion": "1.0",
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36",
"apiVersion": "1.0",
"Content-Type": "application/json;charset=UTF-8"
}
把链接发出来,看看