Fix/handle redirect in api calls#77
Open
robberwick wants to merge 2 commits into
Open
Conversation
Extend the existing validate_api_response model validator to catch
redirect responses (e.g. {'redirect': True, 'region': 'us'}) and raise
RedirectError, preventing a ValidationError on missing fields.
a2378bd to
a281fe6
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.
The LLU API can return redirection responses to non-login requests, so the
_call_apimethod should handle these in the same way that the login request does, by raising aRedirectErrorthat the calling code can deal with.The better longer term solution is probably to provide the ability for any such requests to be retried with the region specified in the api response, but that can come later and is tracked in #76