-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: make load_credentials_from_file
a public method
#530
Conversation
…brary-python into support-scopes
google/auth/_default.py
Outdated
raise exceptions.DefaultCredentialsError( | ||
"The file {file} does not have a valid type. " | ||
"Type is {type}, expected one of {valid_types}.".format( | ||
file=filename, type=credential_type, valid_types=_VALID_TYPES | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The control flow is a little tricky to eyeball grep. It may be easier if it were changed to be something like
if credential_type is None:
raise exceptions.DefaultCredentialsError(...)
# dedented control flow
@busunkim96 This happens to be exactly what I need for my gcloud auth file override work (where gcloud reads cred json files to create google-auth creds) |
@software-dov Please take another look, thanks! |
Turns
_load_credentials_from_file
into a public methodload_credentials_from_file
. Also allow scopes to be passed.On second thought, I'm not sure exposing this method this way is appropriate. Might be deceptive given that it isn't a magical method that can load all credentials 🤔