You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 17, 2026. It is now read-only.
Universes other than the default "googleapis.com" need to be supported in both GAPICs and Apiary. The following code was added to GAPICs but can be moved to python-api-core:
def _get_universe_domain(
client_universe_domain: Optional[str], universe_domain_env: Optional[str]
) -> str: # temp disable Optional
"""Return the universe domain used by the client.
Args:
client_universe_domain (Optional[str]): The universe domain configured via the client options.
universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
Returns:
str: The universe domain to be used by the client.
Raises:
ValueError: If the universe domain is an empty string.
"""
universe_domain = _DEFAULT_UNIVERSE
if client_universe_domain is not None:
universe_domain = client_universe_domain
elif universe_domain_env is not None:
universe_domain = universe_domain_env
if len(universe_domain.strip()) == 0:
raise _Empty_Universe_Error
return universe_domain
def _compare_universes(
client_universe: str, credentials: Union[ga_credentials, oauth2_credentials]
) -> bool:
"""Returns True iff the universe domains used by the client and credentials match.
Args:
client_universe (str): The universe domain configured via the client options.
credentials Union[google.auth.credentials.Credentials, oauth2client.client.Credentials]: The credentials being used in the client.
Returns:
bool: True iff client_universe matches the universe in credentials.
Raises:
ValueError: when client_universe does not match the universe in credentials.
"""
credentials_universe = getattr(credentials, "universe_domain", _DEFAULT_UNIVERSE)
if client_universe != credentials_universe:
raise _UniverseMismatchError(client_universe, credentials_universe)
return True