Better document how to reconstruct `data` object of Webhook events
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 54/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- python
- Domain
- documentation
Research direction
Start with the linked Webhooks documentation and the stripe.Subscription.construct_from() entry point. Confirm whether event.data.object.to_dict() is required and how the key parameter affects reconstructed objects, then document the recommended pattern and add a clear docstring for construct_from().
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Python
- Stars
- 2k
- Forks
- 539
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 26
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stripe/stripe-python
-
feature-request future
Difficulty 4/5 3-5 days Newbie friendliness 35/100
stripe/stripe-python#1886 · 1 comment ·
-
feature-request future
Difficulty 3/5 1-2 days Newbie friendliness 52/100
stripe/stripe-python#1812 · 1 comment ·
-
feature-request future
Difficulty 3/5 1-2 days Newbie friendliness 74/100
stripe/stripe-python#1796 · 3 comments ·
-
feature-request future
Difficulty 4/5 3-5 days Newbie friendliness 38/100
stripe/stripe-python#1465 · 4 comments · 2 reactions ·
-
bug
stripe/stripe-python#1459 · 7 comments · 1 assignee ·
All issues in stripe/stripe-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100