8000 README: response handling by richardm-stripe · Pull Request #656 · stripe/stripe-python · GitHub
[go: up one dir, main page]

Skip to content

README: response handling #656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2020
Merged

Conversation

richardm-stripe
Copy link
Contributor
@richardm-stripe richardm-stripe commented May 12, 2020

r? @remi-stripe
cc @stripe/api-libraries

Attempt at clarifying how to handle responses, as suggested by @mrcoles in #653

I considered explaining

If the response is a success, then the response is always an instance of stripe.stripe_object.StripeObject or the subclass stripe.api_resources.list_object.ListObject

as @mrcoles suggests,

But the details here are pretty complicated and it's been a challenge to describe them in a way that isn't either misleading or potentially confusing. My hope is that accessing some properties on the example will show users how they can grab properties, and will be enough of a hint to discerning users that these aren't plain dicts as you might otherwise expect.

@richardm-stripe richardm-stripe force-pushed the richardm-readme-handling-responses branch from ca2e800 to d0d795b Compare May 12, 2020 16:55
Copy link
Contributor
@remi-stripe remi-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one nitpicky comment but lgtm otherwise.

README.md Outdated
customer = stripe.Customer.retrieve("cus_123456789")

# print that customer's email
print (customer.email)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

8000
@richardm-stripe richardm-stripe force-pushed the richardm-readme-handling-responses branch from d0d795b to d9a2c2c Compare May 12, 2020 17:27
@mrcoles
Copy link
mrcoles commented May 17, 2020

Thanks, @richardm-stripe, this definitely improves the README!

I personally still like to have a little extra info about the specific response type (especially since Python doesn’t give you any additional hints in the code)—in this case a stripe.stripe_object.StripeObject which is the raw response dict or list, but it also allows you to read and set the data as attributes (and then other stuff that I haven’t really looked into, like the request method?) However, any improvement such as the one here makes me happy, and the more curious coder can always dive into REPL and source code.

@richardm-stripe richardm-stripe merged commit d3835ab into master May 22, 2020
@richardm-stripe richardm-stripe deleted the richardm-readme-handling-responses branch May 22, 2020 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0