From 8f8ee7879e4f834f3c676e535ffc41b5b9b2de62 Mon Sep 17 00:00:00 2001 From: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com> Date: Thu, 3 Sep 2020 11:15:13 -0700 Subject: [PATCH 1/2] fix: only add quota project id if supported (#75) --- google/api_core/grpc_helpers.py | 2 +- setup.py | 2 +- tests/asyncio/test_grpc_helpers_async.py | 2 +- tests/unit/test_grpc_helpers.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/api_core/grpc_helpers.py b/google/api_core/grpc_helpers.py index dfc8442d0..0ccbe1264 100644 --- a/google/api_core/grpc_helpers.py +++ b/google/api_core/grpc_helpers.py @@ -216,7 +216,7 @@ def _create_composite_credentials( else: credentials, _ = google.auth.default(scopes=scopes) - if quota_project_id: + if quota_project_id and isinstance(credentials, google.auth.credentials.CredentialsWithQuotaProject): credentials = credentials.with_quota_project(quota_project_id) request = google.auth.transport.requests.Request() diff --git a/setup.py b/setup.py index 6fa56b3c6..27cf0e274 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ dependencies = [ "googleapis-common-protos >= 1.6.0, < 2.0dev", "protobuf >= 3.12.0", - "google-auth >= 1.19.1, < 2.0dev", + "google-auth >= 1.21.1, < 2.0dev", "requests >= 2.18.0, < 3.0.0dev", "setuptools >= 34.0.0", "six >= 1.10.0", diff --git a/tests/asyncio/test_grpc_helpers_async.py b/tests/asyncio/test_grpc_helpers_async.py index 924a74ca6..766e11a9d 100644 --- a/tests/asyncio/test_grpc_helpers_async.py +++ b/tests/asyncio/test_grpc_helpers_async.py @@ -369,7 +369,7 @@ def test_create_channel_explicit_with_quota_project(grpc_secure_channel, composi target = "example.com:443" composite_creds = composite_creds_call.return_value - credentials = mock.create_autospec(google.auth.credentials.Credentials, instance=True) + credentials = mock.create_autospec(google.auth.credentials.CredentialsWithQuotaProject, instance=True) channel = grpc_helpers_async.create_channel( target, credentials=credentials, quota_project_id="project-foo" diff --git a/tests/unit/test_grpc_helpers.py b/tests/unit/test_grpc_helpers.py index f8fed403a..d6ec60a5d 100644 --- a/tests/unit/test_grpc_helpers.py +++ b/tests/unit/test_grpc_helpers.py @@ -341,7 +341,7 @@ def test_create_channel_explicit_with_quota_project(grpc_secure_channel, composi target = "example.com:443" composite_creds = composite_creds_call.return_value - credentials = mock.create_autospec(google.auth.credentials.Credentials, instance=True) + credentials = mock.create_autospec(google.auth.credentials.CredentialsWithQuotaProject, instance=True) channel = grpc_helpers.create_channel( target, From 11d2097b9c125201244836261ae8068a32553586 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2020 11:46:47 -0700 Subject: [PATCH 2/2] chore: release 1.22.2 (#76) * chore: updated CHANGELOG.md [ci skip] * chore: updated setup.cfg [ci skip] * chore: updated setup.py Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ setup.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79ee2556c..1cc0cc521 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ [1]: https://pypi.org/project/google-api-core/#history +### [1.22.2](https://www.github.com/googleapis/python-api-core/compare/v1.22.1...v1.22.2) (2020-09-03) + + +### Bug Fixes + +* only add quota project id if supported ([#75](https://www.github.com/googleapis/python-api-core/issues/75)) ([8f8ee78](https://www.github.com/googleapis/python-api-core/commit/8f8ee7879e4f834f3c676e535ffc41b5b9b2de62)) + ### [1.22.1](https://www.github.com/googleapis/python-api-core/compare/v1.22.0...v1.22.1) (2020-08-12) diff --git a/setup.py b/setup.py index 27cf0e274..5d13b576c 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ name = "google-api-core" description = "Google API client core library" -version = "1.22.1" +version = "1.22.2" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta'