Skip to content
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

Port async support from beta to the stable channel #1288

Merged
merged 8 commits into from
Apr 3, 2024

Conversation

richardm-stripe
Copy link
Contributor

@richardm-stripe richardm-stripe commented Apr 3, 2024

Created via git checkout -p beta <files that weren't codegenned> and some judicious manual cleaning up. I cherry-picked the PRs from outside collaborators for attribution reasons.

richardm-stripe and others added 5 commits April 3, 2024 03:03
* Support AIOHTTPClient init without running event loop

Lazily instantiates and caches an aiohttp `ClientSession` at the points that it is actually used so that `AIOHTTPClient` can be initialized without a running event loop (e.g. when setting `stripe.default_http_client = stripe.AIOHTTPClient()` at the top level of a module).

* Format

* Assert aiohttp module is present in AIOHTTPClient

Fixes a type checking error by having `AIOHTTPClient`'s `_session` property assert that the `aiohttp` module exists

* Remove dependence on cached_property

The `functools.cached_property` decorator did not exist in Python 3.7, so `AIOHTTPClient`'s `_session` has been changed into a regular property that performs caching manually by storing the `ClientSession` object as a member of the instance.

* Define aiohttp cached session attribute in init

Ensures `AIOHTTPClient`'s `_cached_session` attribute is defined in the initializer.
@richardm-stripe richardm-stripe requested review from a team and pakrym-stripe and removed request for a team April 3, 2024 10:15
test-requirements.txt Outdated Show resolved Hide resolved
Copy link
Contributor

@pakrym-stripe pakrym-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments.

@richardm-stripe
Copy link
Contributor Author

cc @pakrym-stripe want to continue to talk through StripeStreamResponseAsync to see if my thoughts are reasonable

@richardm-stripe richardm-stripe merged commit 44a22ec into master Apr 3, 2024
15 checks passed
@richardm-stripe richardm-stripe deleted the richardm-ga-async-2 branch April 3, 2024 23:01
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.

None yet

4 participants