Repository navigation
Conversation
Member
|
Btw this is interesting tool that can help https://pypi.org/project/retry/ - maybe make it easier to define behaviour with different arguments... |
…s-enhancement-claude # Conflicts: # automated_api.py # ayon_api/server_api.py
Requests without a connection session used 'requests.get' etc., which ignored 'ssl_verify' (including 'AYON_CA_FILE') and 'cert'. All requests now go through 'requests.Session' created by '_create_requests_session', and a temporary one is used when the connection has no session. SSL and proxy errors are no longer retried, as sending the request again won't help. Their message is kept in the response detail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Changelog Description
Requests made without a connection session now respect
ssl_verify(includingAYON_CA_FILE) andcert. SSL and proxy errors are no longer retried.Additional review information
Requests without a session used
requests.get,requests.postetc., which ignored the ssl settings of the connection. All REST requests, downloads and uploads now go through arequests.Sessioncreated by_create_requests_session. When the connection has no session, a temporary one is used and closed after the request._base_functions_mappingand_session_functions_mappingwere removed and requests usesession.request(...)instead.SSLErrorandProxyErrorare subclasses ofConnectionError, so they were retriedmax_retriestimes and the response detail only said "Connection error". They're no longer retried, and the error message is kept in the response detail. Downloads and uploads re-raise them right away.Also fixes upload header merging without a session, which compared header keys case-sensitively.
The original idea of this PR (raise exceptions instead of returning a fake response, and let
HTTPAdapterhandle retries) was dropped. Raising would break callers that checkresponse.status, and adapter retries would stack on top of the existing retry loop, which now also handles 502/503 responses.Testing notes:
ServerAPI(..., create_session=False)).SSLErrordetail after a single attempt.tests/test_request_retries.pyandtests/test_download_resume.pypass.