pythonpost请求出错
浏览器f12界面如下
内容如下
请求 URL:
https://t24z.fgf963o.work/jindex.php
请求方法:
POST
状态代码:
200 OK
远程地址:
66.203.155.25:443
引用站点策略:
strict-origin-when-cross-origin
Cache-Control:
no-store, no-cache, must-revalidate
Connection:
keep-alive
Content-Encoding:
gzip
Content-Length:
227
Content-Type:
text/html; charset=utf-8
Date:
Sun, 11 Aug 2024 13:16:14 GMT
Expires:
Thu, 19 Nov 1981 08:52:00 GMT
Pragma:
no-cache
Server:
qq.com
Vary:
Accept-Encoding
POST /jindex.php HTTP/1.1
Accept: application/json, text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
Connection: keep-alive
Content-Length: 118
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Cookie: PHPSESSID=juqbilrp6i7b6ddvqalktop509
Host: t24z.fgf963o.work
Origin: https://t24z.fgf963o.work
Referer: https://t24z.fgf963o.work/index.php?op=view&class=2&spcode=SFE6995&productsid=35445
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0
X-Requested-With: XMLHttpRequest
sec-ch-ua: "Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
我的代码如下
import requests
import json
url = "https://t24z.fgf963o.work/jindex.php"
data = {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, deflate, br, zstd",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
"Connection": "keep-alive",
"Content-Length": "118",
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"Cookie": "PHPSESSID=juqbilrp6i7b6ddvqalktop509",
"Host": "t24z.fgf963o.work",
"Origin": "https://t24z.fgf963o.work",
"Referer": "https://t24z.fgf963o.work/index.php?op=view&class=2&spcode=SFE6995&productsid=35445",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-origin",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0",
"X-Requested-With": "XMLHttpRequest",
"sec-ch-ua": '"Microsoft Edge";v="125", "Chromium";v="125", "Not.A/Brand";v="24"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
}
res = requests.post(url=url, data=json.dumps(data))
print(res.text)
但是返回jmodules error。
其中data=json.dumps(data)和data=data和json=json.dumps(data)和json=data都试过了,都不行。