-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Beta: raw_request_async with HTTPX #1165
Merged
Merged
Conversation
This file contains 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
c27a56c
to
288a34a
Compare
akx
reviewed
Dec 11, 2023
9f4273d
to
288a34a
Compare
Merged
12787e0
to
d6441ec
Compare
akx
reviewed
Dec 14, 2023
05eb962
to
b2a2945
Compare
ced75f8
to
f8dea7b
Compare
richardm-stripe
commented
Dec 15, 2023
richardm-stripe
commented
Dec 15, 2023
Co-authored-by: pakrym-stripe <[email protected]>
29c50ce
to
099f87a
Compare
Ok, this should be ready again. The git history got messy, but since you last looked I
|
pakrym-stripe
requested changes
Jan 4, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions about http client tests
pakrym-stripe
approved these changes
Jan 4, 2024
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
Adds async infrastructure and
stripe.raw_request_async
to the beta channel.Details
Additions:
stripe.raw_request_async
- Gives a small surface area so that we can test async "end to end". We will codegen async methods for each API method in a follow-up.stripe.HTTPClientAsync
- Defines the "interface" for defining an async http client.stripe.HTTPXClient
- Default implementation ofstripe.HTTPClientAsync
. I picked httpx somewhat arbitrarily. It happens to be what openai used (a few months ago, openai-python was a fork of stripe-python with added async support, but this is no longer the case). We can add more or different defaults.stripe.default_http_client_async
- A place for a user to set a custom async client(either a custom
stripe.HTTPXClient
or they can implementHTTPClientAsync
.ApiRequestor.request_async
,ApiRequestor.request_stream_async
,ApiRequestor.request_raw_async
- Infrastructure methods that lie betweenraw_request
andhttp_client
.Notes:
http_client_async
into an ApiRequestor. You have to use the global http client. Mostly this is in the name of minimalism. Shouldn't be needed after StripeClient lands.stripe.new_default_http_client_async
function exists but it is not exported publicly. It doesn't make too much sense to add because there's only one baked-in HTTPClientAsync: HTTPX, so you might as well just construct astripe.HTTPXClient
.verify_ssl_certs
andproxy
twice. In theory we could try and unify the interface for setting these settings on the global client, but I don't think this is an important enough use case to justify the additional complication.