From d9a2c2c1e9421bde8d795a66752a3ccd5d419599 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Tue, 12 May 2020 12:53:51 -0400 Subject: [PATCH 1/2] Explain in README.md how to handle responses --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a77ecd40a..baa1c9151 100644 --- a/README.md +++ b/README.md @@ -43,12 +43,26 @@ import stripe stripe.api_key = "sk_test_..." # list customers -stripe.Customer.list() +customers = stripe.Customer.list() -# retrieve single Customer -stripe.Customer.retrieve("cus_123456789") +# print the first customer's email +print(customers.data[0].email) + +# retrieve specific Customer +customer = stripe.Customer.retrieve("cus_123456789") + +# print that customer's email +print(customer.email) ``` +### Handling exceptions + +Unsuccessful requests raise exceptions. The class of the exception will reflect +the sort of error that occurred. Please see the [Api +Reference](https://stripe.com/docs/api/errors/handling) for a description of +the error classes you should handle, and for information on how to inspect +these errors. + ### Per-request Configuration Configure individual requests with keyword arguments. For example, you can make From 2fdd288ee945fba256594f46ff99def699f2b0ee Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Wed, 13 May 2020 11:08:34 -0400 Subject: [PATCH 2/2] bump