#jeffnv-python-unit-tests

1 messages · Page 1 of 1 (latest)

stone copper
#

What do you mean by "adding nesting"? Most Stripe objects have 1 or more nested objects within them, so I'm not sure of a way to omit that (if that's what you're hoping to do)

raven matrix
#

i think it's setting the entire dictionary as the id or something

#

whats the best way to deserialize a json blob that represents a Subscription?

#

(im new to python, so maybe this is just a python basics question)

#

json.loads(STRIPE_SUB_MOCK, object_hook=stripe.Subscription)

#

something like that?

stone copper
#

Hmmm, let me dig on this a minute and circle back

raven matrix
#

stripe.util.convert_to_stripe_object(STRIPE_SUB_MOCK)

#

that doesn't seem to do anything

#

I got the json string like this:

#

json.dumps(stripe_sub.to_dict_recursive())

#

where stripe_sub is an instance of a stripe subscription object

#

ah OK I think I have it!

#

if i do stripe.util.convert_to_dict(stripe_sub) that works with convert_to_stripe_object

#

but whatever the recursive_dict method gave me was not

stone copper
#

Ahhh, okay. Does that get you oriented in the right direction then?

raven matrix
#

i believe so

#

thank you