|
49 | 49 | # Warning when using Cloud SDK user credentials |
50 | 50 | _CLOUD_SDK_CREDENTIALS_WARNING = """\ |
51 | 51 | Your application has authenticated using end user credentials from Google \ |
52 | | -Cloud SDK. We recommend that most server applications use service accounts \ |
53 | | -instead. If your application continues to use end user credentials from Cloud \ |
54 | | -SDK, you might receive a "quota exceeded" or "API not enabled" error. For \ |
55 | | -more information about service accounts, see \ |
56 | | -https://cloud.google.com/docs/authentication/""" |
| 52 | +Cloud SDK without a quota project. You might receive a "quota exceeded" \ |
| 53 | +or "API not enabled" error. We recommend you rerun \ |
| 54 | +`gcloud auth application-default login` and make sure a quota project is \ |
| 55 | +added. Or you can use service accounts instead. For more information \ |
| 56 | +about service accounts, see https://cloud.google.com/docs/authentication/""" |
57 | 57 |
|
58 | 58 |
|
59 | 59 | def _warn_about_problematic_credentials(credentials): |
@@ -114,8 +114,8 @@ def _load_credentials_from_file(filename): |
114 | 114 | msg = "Failed to load authorized user credentials from {}".format(filename) |
115 | 115 | new_exc = exceptions.DefaultCredentialsError(msg, caught_exc) |
116 | 116 | six.raise_from(new_exc, caught_exc) |
117 | | - # Authorized user credentials do not contain the project ID. |
118 | | - _warn_about_problematic_credentials(credentials) |
| 117 | + if not credentials.quota_project_id: |
| 118 | + _warn_about_problematic_credentials(credentials) |
119 | 119 | return credentials, None |
120 | 120 |
|
121 | 121 | elif credential_type == _SERVICE_ACCOUNT_TYPE: |
|
0 commit comments