Repository navigation
Make retries and failover safe for requests that change state - #4
Merged
Merged
Conversation
A request that starts or stops a session or sets prices is now resent, to the same or another API host, only when the connection could not be established; a timeout no longer sends it a second time. GET, PUT and DELETE requests are also retried after connection errors and timeouts. Retry-After is capped by the new max_retry_after option (60 seconds) and accepts an HTTP date. HTTP 400 raises ValidationError and HTTP 409 the new ConflictError. ConfigurationError is also a ValueError, and invalid OCTA_* numbers raise it. The API token is left out of repr(ClientConfig).
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
Retry-After. The wait is capped by the newmax_retry_afteroption (OCTA_MAX_RETRY_AFTER, 60 seconds by default); a longer wait raisesRateLimitErrorat once. The header is also accepted as an HTTP date.ValidationError(a subclass ofAPIError, so existingexcept APIErrorkeeps working); HTTP 409 raises the newConflictError. Every transport failure raisesAPIConnectionErrororAPITimeoutErrorinstead of anhttpxexception.ConfigurationErroris also aValueError; invalidOCTA_*numbers raise it with the variable name. The API token no longer appears inrepr(ClientConfig).Verification
ruff check,ruff format --check,mypy(strict),pytest: 78 passed, 100% coverageRetry-Aftercap and HTTP date, 400/409 mapping, token not inrepr, invalid environment numbers