You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I receive a customer data from Stripe and the address_zip is an empty string, that's what I receive from Stripe... now, when I try to retrieve it from cache, due to the cache using pickle I will get the famous ValueError: You cannot set address_zip to an empty string. We interpret empty strings as None in requests.You may set...
I want to emphasize that the field comes as an empty string calling the Stripe python api.
It's easy to reproduce tho:
In [5]: new_card = stripe.Card.construct_from({'id': 'ca_test', 'address_zip': ''}, 'api_key')
...: pc = pickle.dumps(new_card)
...: card = pickle.loads(pc)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-5-3cbc1f7a74ed> in <module>
1 new_card = stripe.Card.construct_from({'id': 'ca_test', 'address_zip': ''}, 'api_key')
2 pc = pickle.dumps(new_card)
----> 3 card = pickle.loads(pc)
/usr/local/lib/python3.6/site-packages/stripe/resource.py in __setitem__(self, k, v)
131 "We interpret empty strings as None in requests."
132 "You may set %s.%s = None to delete the property" % (
--> 133 k, str(self), k))
134
135 super(StripeObject, self).__setitem__(k, v)
ValueError: You cannot set address_zip to an empty string. We interpret empty strings as None in requests.You may set {
"id": "ca_test"
}.address_zip = None to delete the property
Here is the proof of the api call from Python:
My workaround was to sanitize all the fields in case of empty string...
I don't know why the request returns a field with an empty string in the first case tho.
The text was updated successfully, but these errors were encountered:
Hi @eka, can you share the versions of Python and stripe-python you're using? I was unable to reproduce this issue with Python 3.8.1 / stripe-python 2.42.0:
Hi,
I receive a customer data from Stripe and the address_zip is an empty string, that's what I receive from Stripe... now, when I try to retrieve it from cache, due to the cache using pickle I will get the famous
ValueError: You cannot set address_zip to an empty string. We interpret empty strings as None in requests.You may set...
I want to emphasize that the field comes as an empty string calling the Stripe python api.
It's easy to reproduce tho:
Here is the proof of the api call from Python:
My workaround was to sanitize all the fields in case of empty string...
I don't know why the request returns a field with an empty string in the first case tho.
The text was updated successfully, but these errors were encountered: