(self, session)
| 77 | self._oauth_basic = HTTPBasicAuth(self._user_basic, self._pw_basic) |
| 78 | |
| 79 | def resume_session(self, session): |
| 80 | self.session.headers['Authorization'] = f'bearer {session["access_token"]}' |
| 81 | r = self.session.get(f'https://{self._oauth_host}/account/api/oauth/verify', |
| 82 | timeout=self.request_timeout) |
| 83 | if r.status_code >= 500: |
| 84 | r.raise_for_status() |
| 85 | |
| 86 | j = r.json() |
| 87 | if 'errorMessage' in j: |
| 88 | self.log.warning(f'Login to EGS API failed with errorCode: {j["errorCode"]}') |
| 89 | raise InvalidCredentialsError(j['errorCode']) |
| 90 | |
| 91 | # update other data |
| 92 | session.update(j) |
| 93 | self.user = session |
| 94 | return self.user |
| 95 | |
| 96 | def start_session(self, refresh_token: str = None, exchange_token: str = None, |
| 97 | authorization_code: str = None, client_credentials: bool = False) -> dict: |
no test coverage detected