Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.

Commit f450551

Browse files
fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#304)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 459095142 Source-Link: googleapis/googleapis@4f1be99 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ae686d9cde4fc3e36d0ac02efb8643b15890c1ed Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9 feat: add audience parameter PiperOrigin-RevId: 456827138 Source-Link: googleapis/googleapis@23f1a15 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4075a8514f676691ec156688a5bbf183aa9893ce Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9
1 parent 8c758a3 commit f450551

File tree

13 files changed

+138
-25
lines changed

13 files changed

+138
-25
lines changed

google/cloud/texttospeech_v1/services/text_to_speech/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ def __init__(
422422
quota_project_id=client_options.quota_project_id,
423423
client_info=client_info,
424424
always_use_jwt_access=True,
425+
api_audience=client_options.api_audience,
425426
)
426427

427428
def list_voices(

google/cloud/texttospeech_v1/services/text_to_speech/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def __init__(
5454
quota_project_id: Optional[str] = None,
5555
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5656
always_use_jwt_access: Optional[bool] = False,
57+
api_audience: Optional[str] = None,
5758
**kwargs,
5859
) -> None:
5960
"""Instantiate the transport.
@@ -81,11 +82,6 @@ def __init__(
8182
be used for service account credentials.
8283
"""
8384

84-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
85-
if ":" not in host:
86-
host += ":443"
87-
self._host = host
88-
8985
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9086

9187
# Save the scopes.
@@ -106,6 +102,11 @@ def __init__(
106102
credentials, _ = google.auth.default(
107103
**scopes_kwargs, quota_project_id=quota_project_id
108104
)
105+
# Don't apply audience if the credentials file passed from user.
106+
if hasattr(credentials, "with_gdch_audience"):
107+
credentials = credentials.with_gdch_audience(
108+
api_audience if api_audience else host
109+
)
109110

110111
# If the credentials are service account credentials, then always try to use self signed JWT.
111112
if (
@@ -118,6 +119,11 @@ def __init__(
118119
# Save the credentials.
119120
self._credentials = credentials
120121

122+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
123+
if ":" not in host:
124+
host += ":443"
125+
self._host = host
126+
121127
def _prep_wrapped_messages(self, client_info):
122128
# Precompute the wrapped methods.
123129
self._wrapped_methods = {

google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(
5757
quota_project_id: Optional[str] = None,
5858
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5959
always_use_jwt_access: Optional[bool] = False,
60+
api_audience: Optional[str] = None,
6061
) -> None:
6162
"""Instantiate the transport.
6263
@@ -152,6 +153,7 @@ def __init__(
152153
quota_project_id=quota_project_id,
153154
client_info=client_info,
154155
always_use_jwt_access=always_use_jwt_access,
156+
api_audience=api_audience,
155157
)
156158

157159
if not self._grpc_channel:

google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def __init__(
102102
quota_project_id=None,
103103
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
104104
always_use_jwt_access: Optional[bool] = False,
105+
api_audience: Optional[str] = None,
105106
) -> None:
106107
"""Instantiate the transport.
107108
@@ -197,6 +198,7 @@ def __init__(
197198
quota_project_id=quota_project_id,
198199
client_info=client_info,
199200
always_use_jwt_access=always_use_jwt_access,
201+
api_audience=api_audience,
200202
)
201203

202204
if not self._grpc_channel:

google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ def __init__(
422422
quota_project_id=client_options.quota_project_id,
423423
client_info=client_info,
424424
always_use_jwt_access=True,
425+
api_audience=client_options.api_audience,
425426
)
426427

427428
def list_voices(

google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def __init__(
5454
quota_project_id: Optional[str] = None,
5555
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5656
always_use_jwt_access: Optional[bool] = False,
57+
api_audience: Optional[str] = None,
5758
**kwargs,
5859
) -> None:
5960
"""Instantiate the transport.
@@ -81,11 +82,6 @@ def __init__(
8182
be used for service account credentials.
8283
"""
8384

84-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
85-
if ":" not in host:
86-
host += ":443"
87-
self._host = host
88-
8985
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9086

9187
# Save the scopes.
@@ -106,6 +102,11 @@ def __init__(
106102
credentials, _ = google.auth.default(
107103
**scopes_kwargs, quota_project_id=quota_project_id
108104
)
105+
# Don't apply audience if the credentials file passed from user.
106+
if hasattr(credentials, "with_gdch_audience"):
107+
credentials = credentials.with_gdch_audience(
108+
api_audience if api_audience else host
109+
)
109110

110111
# If the credentials are service account credentials, then always try to use self signed JWT.
111112
if (
@@ -118,6 +119,11 @@ def __init__(
118119
# Save the credentials.
119120
self._credentials = credentials
120121

122+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
123+
if ":" not in host:
124+
host += ":443"
125+
self._host = host
126+
121127
def _prep_wrapped_messages(self, client_info):
122128
# Precompute the wrapped methods.
123129
self._wrapped_methods = {

google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(
5757
quota_project_id: Optional[str] = None,
5858
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
5959
always_use_jwt_access: Optional[bool] = False,
60+
api_audience: Optional[str] = None,
6061
) -> None:
6162
"""Instantiate the transport.
6263
@@ -152,6 +153,7 @@ def __init__(
152153
quota_project_id=quota_project_id,
153154
client_info=client_info,
154155
always_use_jwt_access=always_use_jwt_access,
156+
api_audience=api_audience,
155157
)
156158

157159
if not self._grpc_channel:

google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def __init__(
102102
quota_project_id=None,
103103
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
104104
always_use_jwt_access: Optional[bool] = False,
105+
api_audience: Optional[str] = None,
105106
) -> None:
106107
"""Instantiate the transport.
107108
@@ -197,6 +198,7 @@ def __init__(
197198
quota_project_id=quota_project_id,
198199
client_info=client_info,
199200
always_use_jwt_access=always_use_jwt_access,
201+
api_audience=api_audience,
200202
)
201203

202204
if not self._grpc_channel:

setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@
4141
# 'Development Status :: 5 - Production/Stable'
4242
release_status = "Development Status :: 5 - Production/Stable"
4343
dependencies = [
44-
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
45-
# Until this issue is closed
46-
# https://github.com/googleapis/google-cloud-python/issues/10566
47-
"google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",
44+
"google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*",
4845
"proto-plus >= 1.15.0, <2.0.0dev",
4946
"protobuf >= 3.19.0, <4.0.0dev",
5047
]

testing/constraints-3.6.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)