|
76 | 76 | # Application Default Credentials.
|
77 | 77 | GOOGLE_APPLICATION_CREDENTIALS = 'GOOGLE_APPLICATION_CREDENTIALS'
|
78 | 78 |
|
| 79 | +# The error message we show users when we can't find the Application |
| 80 | +# Default Credentials. |
| 81 | +ADC_HELP_MSG = ( |
| 82 | + 'The Application Default Credentials are not available. They are available ' |
| 83 | + 'if running in Google Compute Engine. Otherwise, the environment variable ' |
| 84 | + + GOOGLE_APPLICATION_CREDENTIALS + |
| 85 | + ' must be defined pointing to a file defining the credentials. See ' |
| 86 | + 'https://developers.google.com/accounts/docs/application-default-credentials' # pylint:disable=line-too-long |
| 87 | + ' for more information.') |
| 88 | + |
79 | 89 | # The access token along with the seconds in which it expires.
|
80 | 90 | AccessTokenInfo = collections.namedtuple(
|
81 | 91 | 'AccessTokenInfo', ['access_token', 'expires_in'])
|
@@ -1052,13 +1062,7 @@ def get_application_default():
|
1052 | 1062 | elif env_name == 'GCE_PRODUCTION':
|
1053 | 1063 | return _get_application_default_credential_GCE()
|
1054 | 1064 | else:
|
1055 |
| - raise ApplicationDefaultCredentialsError( |
1056 |
| - 'The Application Default Credentials are not available. They are ' |
1057 |
| - 'available if running in Google Compute Engine. Otherwise, the ' |
1058 |
| - ' environment variable ' + GOOGLE_APPLICATION_CREDENTIALS + |
1059 |
| - ' must be defined pointing to a file defining the credentials. ' |
1060 |
| - 'See https://developers.google.com/accounts/docs/application-default-' |
1061 |
| - 'credentials for more information.') |
| 1065 | + raise ApplicationDefaultCredentialsError(ADC_HELP_MSG) |
1062 | 1066 |
|
1063 | 1067 | @staticmethod
|
1064 | 1068 | def from_stream(credential_filename):
|
|
0 commit comments