You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.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
The text was updated successfully, but these errors were encountered:
@AaronBeaudoin thanks for the detailed report! This feels similar to how items on Subscription can't be accessed by sub.items because items is a default method on dict which all our API resources inherit from. We'll see if this is something we could fix in the future though.
Describe the bug
Incoming webhook events have a
request
data attribute, but theevent
instance already has arequest
bound method, so we end up with a bit of a conflict. The data attribute can still be accessed withevent["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.request
andevent["request"]
both returning different things is rather confusing, and it took me quite a while to figure out what was going on.To Reproduce
event.request
.event["request"]
.I would probably consider this less of a "bug" and more of an oversight.
Expected behavior
The
event.request
method should probably be something likeevent._request
so it doesn't conflict with the incoming data. That way I can callevent.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
The text was updated successfully, but these errors were encountered: