#victoria-event-object

1 messages · Page 1 of 1 (latest)

limber lichen
#

Hi there! What language are you using?

#

In Node you should be able to access properties via dot notation

lean coral
#

Hi, im using Python

limber lichen
#

I believe the same is true of Python though I'm not a Python dev

lean coral
#

It is possible in Python, but its necessary to create a method to emulate the access of dict key like a model attribute (via dot).

#

I was wonder if stripe did this method in the background

#

or i am missing something

#
        delivery_id = event.data.object.custom_fields[0]["value"]
    if event["data"]["object"]["object"] == "payment_intent":
        invoice_id = event.data.object.invoice```
lean coral
#

you can see that i access the event object in two ways

clever hemlock
#

👋 Hopping in to help!

#

We use a custom object to support dot notation and accessing them traditionally as a dict

lean coral
#

Hi @clever hemlock !

lean coral
#

So in both ways is possible, and i can switch between them anytime?

clever hemlock
#

Yes, you can switch between them, but there are some thing that will only work with the dict notation - specifically, subscription items have to be accessed like 'subscription[items]'. 'subscription.items' will not work because items() is a built in function (https://docs.python.org/3/library/stdtypes.html#dict.items)

lean coral
#

Wow! very nice!

#

Thank you so much @clever hemlock !!