-
Notifications
You must be signed in to change notification settings - Fork 522
Description
Thank you for your continued work on this library.
Describe the bug:
When login_customer_id is set to None, the library converts it to the string "None" (via str(...)) during config validation, which then fails customer ID validation.
This appears to happen in the config validation flow (related code):
As a result, passing login_customer_id=None raises a ValueError even though the user intent is “unset / not provided”.
Steps to Reproduce:
- Set the credentials as below (sanitized values; only
login_customer_id=Nonematters)
credentials = {
"developer_token": "REDACTED",
"client_id": "REDACTED",
"client_secret": "REDACTED",
"refresh_token": "REDACTED",
"login_customer_id": None,
"use_proto_plus": True,
}- Initialize the client using the credentials
from google.ads.googleads.client import GoogleAdsClient
client = GoogleAdsClient.load_from_dict(credentials, version="v20")Expected behavior:
No error (or login_customer_id remains None / is treated as “not set”), so that initialization succeeds when login_customer_id is intentionally omitted.
Client library version and API version:
Client library version: v29.0
Google Ads API version: v20
Request/Response Logs:
...
File "xxxx.py", line xxxx, in xxxx
client = GoogleAdsClient.load_from_dict(credentials,version="v20")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/google/ads/googleads/client.py", line 291, in load_from_dict
config_data: Dict[str, Any] = config.load_from_dict(config_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/google/ads/googleads/config.py", line 77, in validation_wrapper
validate_dict(config_dict)
File "/usr/local/lib/python3.12/site-packages/google/ads/googleads/config.py", line 208, in validate_dict
validate_login_customer_id(str(config_data["login_customer_id"]))
File "/usr/local/lib/python3.12/site-packages/google/ads/googleads/config.py", line 244, in validate_login_customer_id
_validate_customer_id(login_customer_id, "login")
File "/usr/local/lib/python3.12/site-packages/google/ads/googleads/config.py", line 230, in _validate_customer_id
raise ValueError(
ValueError: The specified login customer ID is invalid. It must be a ten digit number represented as a string, i.e. '1234567890'
)
Anything else we should know about your project / environment: