pip install requests pip install xlwt
fetch("http://117.68.0.190:8001/sxsp-web/public/getPublicList.do", {
"headers": {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"x-requested-with": "XMLHttpRequest",
"cookie": "JSESSIONID=C423DF3FF63C3AECEF1F4D7964E8481C",
"Referer": "http://117.68.0.190:8001/sxsp-web/views/apply/publicity/items.jsp?sslbmc=SPJYXK&title=%E9%A3%9F%E5%93%81%E7%BB%8F%E8%90%A5%E8%AE%B8%E5%8F%AF%E8%8E%B7%E8%AF%81%E4%BC%81%E4%B8%9A%E5%85%AC%E7%A4%BA",
"Referrer-Policy": "strict-origin-when-cross-origin"
},
"body": "currentPageNo=1&pageSize=10&sslbmc=SPJYXK&szds=%E5%90%88%E8%82%A5%E5%B8%82&jlgslb=&tyshxydmOrQymc=",
"method": "POST"
});
import requests
import json
# 目标 URL
url = "http://117.68.0.190:8001/sxsp-web/public/getPublicList.do"
# 请求头
headers = {
"accept": "*/*",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"x-requested-with": "XMLHttpRequest",
"cookie": "JSESSIONID=C423DF3FF63C3AECEF1F4D7964E8481C",
"Referer": "http://117.68.0.190:8001/sxsp-web/views/apply/publicity/items.jsp?sslbmc=SPJYXK&title=%E9%A3%9F%E5%93%81%E7%BB%8F%E8%90%A5%E8%AE%B8%E5%8F%AF%E8%8E%B7%E8%AF%81%E4%BC%81%E4%B8%9A%E5%85%AC%E7%A4%BA",
"Referrer-Policy": "strict-origin-when-cross-origin"
}
# 请求体
data = {
"currentPageNo": 1,
"pageSize": 10,
"sslbmc": "SPJYXK",
"szds": "合肥市",
"jlgslb": "",
"tyshxydmOrQymc": ""
}
# 发送 POST 请求
response = requests.post(url, headers=headers, data=data)
# 检查请求是否成功
if response.status_code == 200:
# 解析 JSON 数据
result = response.json()
# 打印总记录数
print("总记录数:", result.get("total"))
# 打印每条记录
for item in result.get("rows", []):
print("企业名称:", item.get("qymc"))
print("法定代表人:", item.get("fddbr"))
print("注册日期:", item.get("zzrq"))
print("社会信用代码:", item.get("tyxydm"))
print("所在地区:", item.get("szds"))
print("-" * 40)
else:
print("请求失败,状态码:", response.status_code)