(token)
| 157 | write_token_cache(cache) |
| 158 | |
| 159 | def validate_token(token): |
| 160 | try: |
| 161 | resp = session.post( |
| 162 | f"{APP_BASE}/getUserLevelInfoByUid", |
| 163 | headers=app_headers(token), |
| 164 | timeout=15, |
| 165 | ) |
| 166 | if resp.status_code != 200: |
| 167 | return False |
| 168 | data = resp.json() |
| 169 | if is_success(data): |
| 170 | return True |
| 171 | return not is_token_error(data) |
| 172 | except Exception: |
| 173 | return False |
| 174 | |
| 175 | def get_token_for_account(account_id, index): |
| 176 | cached = get_cached_token(account_id) |
no test coverage detected