Commit adc3ee6
fix: Raise meaningful exception when oauth callback times out (#363)
I found that when `timeout_seconds` parameter is used, the code raises
an exception such as:
```
File "/usr/lib/python3.12/site-packages/google_auth_oauthlib/flow.py", line 520, in run_local_server
authorization_response = wsgi_app.last_request_uri.replace("http", "https")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'
```
This PR adds a custom exception such that a caller can handle this case.
I'm unable to run the full `nox` suite locally, but it looks like
nothing has broken. I'll make any changes needed when the CI tests run.
---------
Co-authored-by: Chalmer Lowe <chalmerlowe@google.com>1 parent 0994627 commit adc3ee6Copy full SHA for adc3ee6
2 files changed
+37-3Lines changed: 37 additions & 3 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- packages/google-auth-oauthlib
- google_auth_oauthlib
- tests/unit
Expand file treeCollapse file tree
Open diff view settings
Collapse file
packages/google-auth-oauthlib/google_auth_oauthlib/flow.py
Copy file name to clipboardExpand all lines: packages/google-auth-oauthlib/google_auth_oauthlib/flow.py+20-3Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
410 | 410 | |
411 | 411 | |
412 | 412 | |
413 | | - |
414 | | - |
| 413 | + |
| 414 | + |
| 415 | + |
415 | 416 | |
416 | 417 | |
417 | 418 | |
| ||
425 | 426 | |
426 | 427 | |
427 | 428 | |
| 429 | + |
| 430 | + |
| 431 | + |
| 432 | + |
428 | 433 | |
429 | 434 | |
430 | 435 | |
| ||
455 | 460 | |
456 | 461 | |
457 | 462 | |
458 | | - |
| 463 | + |
| 464 | + |
| 465 | + |
| 466 | + |
| 467 | + |
| 468 | + |
| 469 | + |
| 470 | + |
| 471 | + |
459 | 472 | |
460 | 473 | |
461 | 474 | |
| ||
506 | 519 | |
507 | 520 | |
508 | 521 | |
| 522 | + |
| 523 | + |
| 524 | + |
| 525 | + |
Collapse file
packages/google-auth-oauthlib/tests/unit/test_flow.py
Copy file name to clipboardExpand all lines: packages/google-auth-oauthlib/tests/unit/test_flow.py+17Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
497 | 497 | |
498 | 498 | |
499 | 499 | |
| 500 | + |
| 501 | + |
| 502 | + |
| 503 | + |
| 504 | + |
| 505 | + |
| 506 | + |
| 507 | + |
| 508 | + |
| 509 | + |
| 510 | + |
| 511 | + |
| 512 | + |
| 513 | + |
| 514 | + |
| 515 | + |
| 516 | + |
0 commit comments