From 1a7377c822163bd9ffa077e61a7088097c7dd993 Mon Sep 17 00:00:00 2001 From: corlord Date: Tue, 15 Oct 2024 14:34:00 -0600 Subject: [PATCH 1/2] Update client.py error handler for package version lookup --- google/ads/googleads/client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/google/ads/googleads/client.py b/google/ads/googleads/client.py index 671f5263f..6e3cb18f4 100644 --- a/google/ads/googleads/client.py +++ b/google/ads/googleads/client.py @@ -13,7 +13,7 @@ # limitations under the License. """A client and common configurations for the Google Ads API.""" -from importlib import import_module, metadata +from importlib import import_module, metadata, Pack import logging.config from google.api_core.gapic_v1.client_info import ClientInfo @@ -36,7 +36,10 @@ # Retrieve the version of this client library to be sent in the user-agent # information of API calls. -_CLIENT_INFO = ClientInfo(client_library_version=metadata.version("google-ads")) +try: + _CLIENT_INFO = ClientInfo(client_library_version=metadata.version("google-ads")) +except metadata.PackageNotFoundError: + _CLIENT_INFO = ClientInfo() # See options at grpc.github.io/grpc/core/group__grpc__arg__keys.html _GRPC_CHANNEL_OPTIONS = [ From 0d7cef91d16468c660ed77557beab8d49875a9e7 Mon Sep 17 00:00:00 2001 From: corlord Date: Tue, 15 Oct 2024 14:37:08 -0600 Subject: [PATCH 2/2] remove import --- google/ads/googleads/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/ads/googleads/client.py b/google/ads/googleads/client.py index 6e3cb18f4..007f8e445 100644 --- a/google/ads/googleads/client.py +++ b/google/ads/googleads/client.py @@ -13,7 +13,7 @@ # limitations under the License. """A client and common configurations for the Google Ads API.""" -from importlib import import_module, metadata, Pack +from importlib import import_module, metadata import logging.config from google.api_core.gapic_v1.client_info import ClientInfo