For webhooks, `webhook.request` is both a method and a data attribute
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
まず StripeObject.request メソッドと webhook イベントの構築経路を特定します。event.request と event["request"] の違いを再現し、その後、関連するテストや互換性に関する想定を確認します。Webhook リクエストデータに一貫してアクセスでき、メソッドが本来意図している動作を失わなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Incoming webhook events have a request data attribute, but the event instance already has a request bound method, so we end up with a bit of a conflict. The data attribute can still be accessed with event["request"] but it feels weird to need to do that for just that one data attribute and then use dot syntax for everything else.
>>> event = stripe.Webhook.construct_event(...)
>>> event.request
<bound method StripeObject.request of <Event event id=<id_omitted> at 0x1035bb450> JSON: { ...
>>> event["request"]
<StripeObject id=<id_omitted> at 0x102e95810> JSON: {
"id": "<id_omitted>",
"idempotency_key": "<idempotency_key_omitted>"
}
event.request and event["request"] both returning different things is rather confusing, and it took me quite a while to figure out what was going on.
To Reproduce
- Construct a webhook event.
- Access
event.request. - Access
event["request"]. - Notice that they are different.
I would probably consider this less of a "bug" and more of an oversight.
Expected behavior
The event.request method should probably be something like event._request so it doesn't conflict with the incoming data. That way I can call event.request and actually get the attribute from the body of the webhook as expected.
Code snippets
No response
OS
macOS
Language version
Python 3.9.10
Library version
stripe-python v2.76.0
API version
2020-08-27
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 日以内に返信
-
Add async context manager support for AIOHTTPClient and HTTPXClient再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンfeature-request future
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
stripe/stripe-python#1796 · コメント 3 件 ·
メンテナーはふだん 2 日以内に返信
stripe/stripe-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
area:docs
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
RailtownAI/railtracks#1633 ·
メンテナーはふだん 2 日以内に返信
-
review-panel severity:low
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
kristovatlas/coin-accounting#152 ·
メンテナーはふだん 1 日以内に返信
-
documentation :blue_book:
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
PennyLaneAI/pennylane#10280 ·
メンテナーはふだん 2 日以内に返信
-
`pipx reinstall` prints a Python traceback when the reinstall fails対応中かも @ParamTanna が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信