Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__dict__ vs to_dict() #33

Open
goblinJoel opened this issue Sep 5, 2019 · 0 comments
Open

__dict__ vs to_dict() #33

goblinJoel opened this issue Sep 5, 2019 · 0 comments

Comments

@goblinJoel
Copy link

goblinJoel commented Sep 5, 2019

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

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

No branches or pull requests

1 participant