googleads / google-ads-python

Google Ads API Client Library for Python
Apache License 2.0
526 stars 480 forks source link

Applied fix to AttributeError when assigning to "geo_target_constants" #842

Closed imshawan closed 5 months ago

imshawan commented 9 months ago

This pull request addresses an AttributeError encountered while attempting to assign values to the "geo_target_constants" property in the GenerateKeywordIdeasRequest message type.

Before the fix, the code attempted to assign a value directly to the "geo_target_constants" property:

request = client.get_type("GenerateKeywordIdeasRequest")
request.geo_target_constants = location_rns

However, this resulted in an AttributeError, as direct assignment to repeated fields is not allowed in protocol message objects.

To resolve this issue, the code has been updated to properly assign a list of values to the "geo_target_constants" field:

request = client.get_type("GenerateKeywordIdeasRequest")
request.geo_target_constants.extend(location_rns)

This ensures that the values are correctly assigned to the repeated field "geo_target_constants".

google-cla[bot] commented 9 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.