#foxhop-python-library
1 messages ยท Page 1 of 1 (latest)
my code is open source
I use stripe-python
This is the front end, client side template: https://git.unturf.com/engineering/make-post-sell/make_post_sell/-/blob/master/make_post_sell/templates/snippets/stripe.j2
This is the server side where I accept the stripeToken & create the source https://git.unturf.com/engineering/make-post-sell/make_post_sell/-/blob/develop/make_post_sell/views/billing.py
Can you share which line is no longer working and what error message you get?
these lines used to work, now I get AttributeError on "sources"
also, I used to be able to loop over Customer.sources to view all cards attached to customer, that is also an AttributeError.
I have a test shell running to inspect a hydrated Customer object.
import stripe
stripe.api_key = "sk_test_51...lqjIhsYE"
customer = stripe.Customer.retrieve(id="cus_M30xvGhvbZiCuS")
customer.sources
Traceback (most recent call last):
File "<input>", line 1, in <module>
customer.sources
File "/home/fox/git/make_post_sell_open/env/lib64/python3.10/site-packages/stripe/stripe_object.py", line 92, in getattr
raise AttributeError(*err.args)
AttributeError: sources
I looked at recent changes to https://github.com/stripe/stripe-python nothing immediately jumps out at me as to sources being deprecated on the Customer object.
which version of python library are you using?
I do not have it pinned so my build system is pulling the latest published 5 days ago 3.5.0
Can you reproduce? the AttributeError?
I'm trying to reproduce now
going to try pinning to version 3.40 or 3.3.0 to see if I get a different result
did you expand ['sources']? sources [0] field required expansion in order to return in the response
[0] https://stripe.com/docs/api/customers/object?lang=python#customer_object-sources
i'm able to get it working after expanding sources field
customer = stripe.Customer.retrieve(
id="cus_xxx",
expand=['sources']
)
Without expanding sources, I also get AttributeError
I didn't try this, I didn't know this was needed, likely a new change.
I will try this & see if it fixes my issue.
This works on my local REPL
I will try to alter code to include expand=["sources"]
Glad that it works!
I am going AFK for tonight, I'll continue tomorrow, thanks for helping, I'll keep this thread updated.
No problem! Happy to help ๐ Feel free to come back to this discord channel if you have any further question