MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / cj

Function cj

backup/wangchao.py:265–302  ·  view source on GitHub ↗
(jsessionid, retry_count=3)

Source from the content-addressed store, hash-verified

263
264#抽奖
265def cj(jsessionid, retry_count=3):
266 url = "https://srv-app.taizhou.com.cn/tzrb/userAwardRecordUpgrade/saveUpdate"
267 payload = "activityId=67&sessionId=undefined&sig=undefined&token=undefined"
268 headers = {
269 'Host': 'srv-app.taizhou.com.cn',
270 'Connection': 'keep-alive',
271 'Content-Length': '63',
272 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.101 Mobile Safari/537.36;xsb_wangchao;xsb_wangchao;6.0.2;native_app;6.10.0',
273 'Content-type': 'application/x-www-form-urlencoded',
274 'Accept': '*/*',
275 'Origin': 'https://srv-app.taizhou.com.cn',
276 'X-Requested-With': 'com.shangc.tiennews.taizhou',
277 'Sec-Fetch-Site': 'same-origin',
278 'Sec-Fetch-Mode': 'cors',
279 'Sec-Fetch-Dest': 'empty',
280 'Referer': 'https://srv-app.taizhou.com.cn/luckdraw-ra-1/',
281 'Accept-Encoding': 'gzip, deflate',
282 'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
283 'Cookie': f'{jsessionid}'
284 }
285
286 # 创建一个包含重试策略的会话
287 session = requests.Session()
288 retries = Retry(total=4, backoff_factor=1, status_forcelist=[502, 503, 504])
289 session.mount('https://', HTTPAdapter(max_retries=retries))
290
291 for attempt in range(retry_count):
292 try:
293 response = session.post(url, data=payload, headers=headers, timeout=10)
294 if response.status_code == 200:
295 print(response.text)
296 display_draw_results(jsessionid)
297 return # 成功则退出函数
298 else:
299 print(f"POST 请求失败,状态码: {response.status_code}, 响应内容: {response.text}")
300 except requests.exceptions.RequestException as e:
301 print(f"POST 请求失败 (尝试 {attempt + 1}/{retry_count}): {e}")
302 time.sleep(2) # 在重试前增加延迟
303
304#查询抽奖结果
305def display_draw_results(cookies):

Callers 1

wangchao.pyFile · 0.85

Calls 4

display_draw_resultsFunction · 0.85
sleepMethod · 0.80
printFunction · 0.50
postMethod · 0.45

Tested by

no test coverage detected