Add async context manager support for AIOHTTPClient and HTTPXClient
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
- #1806 @jlaportebot による — マージされずにクローズ
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 74/100
調査の方向性
stripe/_http_client.py を読み、AIOHTTPClient と HTTPXClient のライフサイクルメソッド、特に close() と close_async() を比較します。両方の非同期対応クライアントに非同期コンテキストマネージャーの動作を追加し、async with による開始が機能し、終了時に既存の非同期クリーンアップが実行されることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Is your feature request related to a problem? Please describe.
When using the async HTTP clients directly, there is currently no idiomatic way to manage their lifecycle with async with.
In stripe/_http_client.py:
AIOHTTPClient.close()is a no-opAIOHTTPClientcleanup happens throughclose_async()HTTPXClientalso exposesclose_async()- async-capable clients do not appear to expose
__aenter__/__aexit__
That means users need to remember to call close_async() manually instead of using the standard async context-manager pattern.
Describe the solution you'd like
Add async context manager support to async-capable HTTP clients, for example:
async with stripe.AIOHTTPClient() as http_client:
client = stripe.StripeClient("sk_test_...", http_client=http_client)
customer = await client.v1.customers.retrieve_async("cus_123")
Describe alternatives you've considered
Users can call await close_async() manually after using the client, but that is easier to forget and less ergonomic than supporting the standard async with pattern.
Additional context
No response
- 主要言語
- Python
- スター
- 2.1k
- フォーク
- 538
- 平均マージ
- 2日 16時間
- マージ済み PR(30日)
- 28
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stripe/stripe-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
stripe/stripe-python#1936 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
feature-request future
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
stripe/stripe-python#1886 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
feature-request
難易度 2/5 1〜3時間 初心者へのやさしさ 54/100
stripe/stripe-python#1841 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
feature-request future
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
stripe/stripe-python#1812 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
feature-request future
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
stripe/stripe-python#1465 · コメント 4 件 · リアクション 2 件 ·
メンテナーはふだん 2 日以内に返信
stripe/stripe-python の issue をすべて見る
似ている issue
-
changelog investigate
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ramnes/notion-sdk-py#409 ·
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
lindicaphxag-tech/kaggle#28 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
BSData/horus-heresy-3rd-edition#3211 ·
メンテナーはふだん 1 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
Unreachable-proxy mount test depends on fixed port 9999対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug tests
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信