Is your feature request related to a problem? Please describe.
The documentation currently recommends using stripe.Event.construct_from() to reconstruct the event object, and then access event.data.object to use the actual event data.
However, event.data.object is untyped (UntypedStripeObject[Any]). We currently do:
# Example to reconstruct `Subscription` object, but same applies for any object:
sub = stripe.Subscription.construct_from(
event.data.object.to_dict(),
key=None, # The API key (required)
)
It would be nice if this was explicitly documented (in https://docs.stripe.com/webhooks): is it the expected way of reconstructing the object? do I need to call to_dict()? Also if this is the expected way, construct_from() would benefit from a proper docstring (I first got confused by the required key parameter. It does make sense to have it required, because an implicit None will mean you can't make operations from this object directly, which would be surprising for some users).
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response
Is your feature request related to a problem? Please describe.
The documentation currently recommends using
stripe.Event.construct_from()to reconstruct the event object, and then accessevent.data.objectto use the actual event data.However,
event.data.objectis untyped (UntypedStripeObject[Any]). We currently do:It would be nice if this was explicitly documented (in https://docs.stripe.com/webhooks): is it the expected way of reconstructing the object? do I need to call
to_dict()? Also if this is the expected way,construct_from()would benefit from a proper docstring (I first got confused by the requiredkeyparameter. It does make sense to have it required, because an implicitNonewill mean you can't make operations from this object directly, which would be surprising for some users).Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response