Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Add async context manager support for AIOHTTPClient and HTTPXClient

オープン
#1,796 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

  • #1806 @jlaportebot による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
74/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
api, backend

調査の方向性

stripe/_http_client.py を読み、AIOHTTPClient と HTTPXClient のライフサイクルメソッド、特に close() と close_async() を比較します。両方の非同期対応クライアントに非同期コンテキストマネージャーの動作を追加し、async with による開始が機能し、終了時に既存の非同期クリーンアップが実行されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

feature-request future
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-op
  • AIOHTTPClient cleanup happens through close_async()
  • HTTPXClient also exposes close_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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

stripe/stripe-python のほかの issue

stripe/stripe-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。