Commit fd1436b5 by baiquan

test.py

parent c402c089
import json
from urllib.parse import urlencode
import execjs
import requests
cookie = {
"PHPSESSID": "b128fd38e72c3875d6962d7b7f99c079",
"PHPSESSID_SS": "b128fd38e72c3875d6962d7b7f99c079",
}
headers = {
"accept": "application/json, text/plain, */*",
"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",
"origin": "https://fxg.jinritemai.com",
"referer": "https://fxg.jinritemai.com",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site",
"X-Requested-With": "XMLHttpRequest",
"priority": "u=1, i",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.6778.24 Safari/537.36",
"sec-ch-ua": 'Google Chrome";v = "131", "Chromium";v = "131", "Not_A Brand";v = "24"'
}
params = {'appid': 1, '_bid': 'ffa_goods', 'msToken': 'gD02GzA25s53snK2vlsuGgbyPgGz4CtKfF6CqWC1yMRUfV3BoBeguWbFohK=CaaAYWNhXh28t=vy7WgmEdRYCbBRdFSfsnQOxoOE4CnyxlhQHAQX3oQTeukZfVZWankQX=pqUriUDfhzAKKkPS4qcE87bWlng2P8'}
json_data = {'context': {'feature': {}, 'operation_type': 'select_normal,normal', 'category_id': '26764', 'ability': []}, 'appid': 1, '_bid': 'ffa_goods'}
url = 'https://fxg.jinritemai.com/product/tproduct/getSchema'
url_params = urlencode(params)
with open("./js/a_bogus.js", "r", encoding="utf-8") as f:
js_code = f.read()
ctx = execjs.compile(js_code)
data = json.dumps(json_data)
ab = ctx.call('get_ab', url_params, data, headers['user-agent'])
params['a_bogus'] = ab
# params['a_bogus'] = "DXWhQRu6dk2ivfmk5fCLfY3qV-zfYsuY0SVkMDheJaV-/y39HMOP9exYg/Xv8LbexG/ZIbDjy4hbO3xprQAjM36UHmJx/2aBmDSkKl5Q59YC53ineyfQE0hO-ib3SFad5XNdECifqiKGKuRplnl60fAAPeb="
response = requests.post(url, params=params, cookies=cookie, headers=headers, json=json_data)
print(response.text)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment