(self, method, url, **kwargs)
| 505 | return False |
| 506 | |
| 507 | def request(self, method, url, **kwargs): |
| 508 | try: |
| 509 | current_cookies = self.session.cookies.get_dict() |
| 510 | if self.cookie_string: |
| 511 | for item in self.cookie_string.split(';'): |
| 512 | if '=' in item: |
| 513 | k, v = item.split('=', 1) |
| 514 | current_cookies[k.strip()] = v.strip() |
| 515 | cookie_header = "; ".join([f"{k}={v}" for k, v in current_cookies.items()]) |
| 516 | if cookie_header: |
| 517 | if 'headers' not in kwargs: |
| 518 | kwargs['headers'] = {} |
| 519 | kwargs['headers']['Cookie'] = cookie_header |
| 520 | timeout = kwargs.get('timeout', 10) |
| 521 | if 'timeout' in kwargs: del kwargs['timeout'] |
| 522 | response = self.session.request(method, url, timeout=timeout, **kwargs) |
| 523 | if response.status_code >= 400: |
| 524 | self.log(f"请求 {url} 返回状态码 {response.status_code}") |
| 525 | return response |
| 526 | except Exception as e: |
| 527 | self.log(f"请求 {url} 异常: {str(e)}") |
| 528 | return None |
| 529 | |
| 530 | def load_token_from_cache(self): |
| 531 | if not self.account_mobile: |
no test coverage detected