Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@richardm-stripe
Copy link
Contributor

@richardm-stripe richardm-stripe commented Jan 24, 2024

Summary

Fixes issue reported by @tsalpekaar21 in #327 (comment) where requests that should have been non-retryable were retried, and the wrong exception classes were being produced.

Details

The fix is to stop calling .raise_for_status. The .raise_for_status method causes HTTPX to produce its own exceptions for non-2xx statuses -- but this isn't actually desired. The way that the other HTTP clients in _http_client.py work is that HTTPClient._handle_request_error is responsible only for handling exceptions in cases where the HTTP request actually isn't able to complete. Completed requests with error status codes should be returned from .request so that .should_retry can run, and APIRequestor.interpret_response is responsible for converting this to an appropriate exception.

@richardm-stripe richardm-stripe marked this pull request as ready for review January 25, 2024 00:23
@richardm-stripe richardm-stripe merged commit 53648e5 into beta Jan 26, 2024
@xavdid-stripe xavdid-stripe deleted the richardm-fix-async-retries branch May 10, 2024 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants