Beta: Support 'allow_sync_methods=False' in HTTPXClient #1253
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
Allows initializing HTTPXClient so that synchronous method calls raise an exception.
Motivation
I expect this to be useful for users who want to completely migrate their Stripe integrations to use async control flow. It's easy to miss migrating a method or two, especially if it's a pagination request, and then you have blocking io that you didn't intend.
Brought this up #327 (comment) and at least one user has indicated it would be useful.
It's definitely not impossible for users to subclass HTTPXClient and implement this themselves so maybe this is feature bloat, but I think eventually suggesting this strategy in our README will be helpful, and it addresses some of the migration experience agonies that motivated #1247.