Skip to content

Are stripe objects dicts? #494

Description

@oTree-org

When reading the docs about subscriptions, customers, etc., I sometimes see attribute notation, like

subscription.tax_percent = 10

And sometimes see dict notation, like subscription['items']['data'][0].id, and sometimes see a mix (e.g. in the previous example why not use ['id'] at the end?)

What is the difference between the two? I was wondering if I could use dict notation all the way, like subscription['items']['data'][0]['id']. That means in my tests using unittest.mock I could patch the return values of create, retrieve, etc. using simple dict literals.

(By the way the docs have examples on how to use stripe-python, but I can't find any general explanation of how stripe-python is works, e.g. what data types it uses and how those map to JSON responses.)

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions