Handle HTTP-date Retry-After at Graph call sites#95
Open
gaoflow wants to merge 1 commit into
Open
Conversation
da49d04 to
ee0b76b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #89.
Follow-up to #87 / #62. #87 added
parse_retry_after()and fixed the two call sites named in the original issue; this routes the remainingRetry-Afterparsing inteams.pyandgraph_helpers.pythrough the same helper so HTTP-date headers do not raiseValueError.Preserved the existing defaults:
graph_request()still defaults to 10 seconds.Tests
I wrote the representative regression tests before the implementation; they failed with
ValueErroragainst the oldint(...)parsing and pass after this change.uv run --python 3.12 --extra dev python -m pytest tests/test_graph_helpers.py::TestGraphRequest::test_retry_on_429_with_http_date_retry_after tests/tools/test_teams.py::TestCreateOneOnOneChat::test_429_http_date_retry_after_raises_rate_limit -quv run --python 3.12 --extra dev python -m pytest tests/test_graph_helpers.py tests/tools/test_teams.py tests/tools/test_rate_limit.py tests/tools/test_email.py -quv run --python 3.12 --extra dev python -m pytest -v --tb=short(1534 passed, 1 skipped; existing async runtime warnings)uv run --python 3.12 --extra dev ruff check .git diff --check