(self)
| 24 | self.check_token() |
| 25 | |
| 26 | def token_is_available(self): |
| 27 | if self.token: |
| 28 | try: |
| 29 | self.headers['X-QuakeToken'] = self.token |
| 30 | resp = requests.get( |
| 31 | 'https://quake.360.cn/api/v3/user/info', headers=self.headers) |
| 32 | |
| 33 | if 'month_remaining_credit' not in resp.text: |
| 34 | logger.info(resp.text) |
| 35 | |
| 36 | if resp and resp.status_code == 200 and resp.json()['code'] == 0: |
| 37 | return True |
| 38 | except Exception as ex: |
| 39 | logger.error(str(ex)) |
| 40 | return False |
| 41 | |
| 42 | def check_token(self): |
| 43 | if self.token_is_available(): |