python-samples
python-samples copied to clipboard
Obtaining Credentials Vs Using Credentials --- Separate Them For Clarity's Sake
Summary
To the extent that this is sample code, clarity should be considered integral and fundamental.
Lack of clarity is an "issue". This "issue" applies to most google quickstart.py. All of those can benefit from this.
main() is doing two things:
- obtains the credentials
- uses the credentials to do some thing
So, on top of main() create a function called: obtain_credentials(scopes). It would return creds.
main() would then first do creds = obtain_credentials(scopes) and then comes the service usage part.
This way, the whole thing is a lot more clear and less duplicated (across all quickstart.py-s)
Expected Behavior
See above.
Actual Behavior
See Above.
Steps to Reproduce the Problem
See Above.
Specifications
- Python version (
python --version) = ALL - OS (Mac/Linux/Windows) = ALL