importrequests
importjson
# 设置请求头和URL
headers= {
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
'User-Agent': 'lhb/5.11.3 (com.kaipanla.www; build:1; iOS 16.3.1) Alamofire/5.11.3',
'Accept-Language': 'zh-Hans-CN;q=1.0',
'Accept-Encoding': 'gzip;q=1.0, compress;q=0.5'
}
url='https://apphq.longhuvip.com/w1/api/index.php'
# 设置POST请求的数据
data= {
'PhoneOSNew': '2',
'VerSion': '5.11.0.3',
'a': 'GetPianLiZhi_Index',
'apiv': 'w33',
'c': 'StockBidYiDong'
}
# 发送POST请求
response=requests.post(url, data=data, headers=headers)
# 检查HTTP状态码
ifresponse.status_code==200:
# 解析JSON数据
response_json=response.json()
# 输出解析后的数据,或者按需处理
print(json.dumps(response_json, indent=4, ensure_ascii=False))
else:
print(f'Failed to retrieve data: {response.status_code}')