(self)
| 3362 | self.log(f"安全管家: getAuthToken_sec 异常: {e}") |
| 3363 | |
| 3364 | def getTicketForJF_sec(self): |
| 3365 | if not getattr(self, 'sec_token', None): |
| 3366 | self.log("安全管家 getTicketForJF_sec 缺少 token,跳过") |
| 3367 | return |
| 3368 | try: |
| 3369 | url1 = "https://uca.wo116114.com/api/v1/auth/getTicket?product_line=uasp&entry_point=h5&entry_point_id=edop_unicom_3a6cc75a" |
| 3370 | headers1 = { |
| 3371 | "User-Agent": "ChinaUnicom4.x/12.3.1 (com.chinaunicom.mobilebusiness; build:77; iOS 16.6.0) Alamofire/4.7.3 unicom{version:iphone_c@12.0301}", |
| 3372 | "Content-Type": "application/json", |
| 3373 | "auth-sa-token": self.sec_token, |
| 3374 | "clientType": "uasp_unicom_applet" |
| 3375 | } |
| 3376 | data1 = { "productId": "91311616", "phone": self.account_mobile } |
| 3377 | res1 = self.session.post(url1, json=data1, headers=headers1).json() |
| 3378 | if res1.get('data'): |
| 3379 | self.sec_ticket = res1['data'].get('ticket') |
| 3380 | else: |
| 3381 | self.log("安全管家获取积分票据失败") |
| 3382 | return |
| 3383 | url2 = "https://m.jf.10010.com/jf-external-application/page/query" |
| 3384 | headers2 = { |
| 3385 | "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 unicom{version:iphone_c@12.0301};ltst;OSVersion/16.6", |
| 3386 | "partnersid": "1702", |
| 3387 | "ticket": unquote(self.sec_ticket), |
| 3388 | "clienttype": "uasp_unicom_applet", |
| 3389 | } |
| 3390 | if hasattr(self, 'sec_jeaId'): |
| 3391 | headers2["Cookie"] = f"_jea_id={self.sec_jeaId}" |
| 3392 | res2 = self.session.post(url2, json={"activityId": "s747395186896173056", "partnersId": "1702"}, headers=headers2) |
| 3393 | res2 = self.session.post(url2, json={"activityId": "s747395186896173056", "partnersId": "1702"}, headers=headers2) |
| 3394 | for cookie in self.session.cookies: |
| 3395 | if cookie.name == '_jea_id': |
| 3396 | self.sec_jeaId = cookie.value |
| 3397 | if 'Set-Cookie' in res2.headers: |
| 3398 | match = re.search(r'_jea_id=([^;]+)', res2.headers['Set-Cookie']) |
| 3399 | if match: |
| 3400 | self.sec_jeaId = match.group(1) |
| 3401 | self.log(f"安全管家: 更新 jeaId: {self.sec_jeaId}") |
| 3402 | except Exception as e: |
| 3403 | self.log(f"安全管家: getTicketForJF_sec 异常: {e}") |
| 3404 | |
| 3405 | def get_secret_key_sec(self): |
| 3406 | if getattr(self, 'sec_secretKey', None): |
no test coverage detected