Skip to content

__dict__ vs to_dict() #33

Description

@goblinJoel

Hey, this might be a strange thing to open an issue for, but I'm using the SDK to transition from Authorize.net AIM to CyberSource, and I noticed that all the examples use things like:

request.payment_information = payment_info.__dict__
# etc
message_body = json.dumps(request.__dict__)

instead of:

request.payment_information = payment_info
# etc
message_body = json.dumps(request.do_dict())

...even though the SDK provides to_dict() for a whole lot of things, so it looks like it was designed for that (and it avoids including unwanted attributes by accident). It looks like both ways produce the same output and work on the process_payment.py sample.

Is there a reason to prefer __dict__ each time over a single to_dict() at the end?

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