Blocks until the expected redirect request with either the authorization code/state or and error is handled
(self)
| 253 | ) |
| 254 | |
| 255 | def get_auth_code_and_state(self): |
| 256 | """Blocks until the expected redirect request with either the |
| 257 | authorization code/state or and error is handled |
| 258 | """ |
| 259 | LOG.debug(f'Waiting for auth code at {self.redirect_uri_with_port()}') |
| 260 | start = time.time() |
| 261 | while ( |
| 262 | not self._is_done and time.time() < start + self._OVERALL_TIMEOUT |
| 263 | ): |
| 264 | self.http_server.handle_request() |
| 265 | self.http_server.server_close() |
| 266 | |
| 267 | if not self._is_done: |
| 268 | raise PendingAuthorizationExpiredError |
| 269 | |
| 270 | return self._auth_code, self._state |
| 271 | |
| 272 | def set_auth_code_and_state(self, auth_code, state): |
| 273 | self._auth_code = auth_code |