Good evening, I've been trying to add criterions to a campaign but i
receive this error:
criterion.language = lang_resource.resource_name
^^^^^^^^^^^^^^^^^^
self._pb.MergeFrom(self._meta.pb(**{key: pb_value}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Message must be initialized with a dict:
google.ads.googleads.v13.resources.CampaignCriterion
This is my code, Any idea what is it? i've searched the internet to see if
anyone experienced it also but no luck.
def create_language_op(self, customer_id, campaign_id, lang_name="English"):
googleads_service = self.client.get_service("GoogleAdsService")
criterion_op = self.client.get_type("CampaignCriterionOperation")
query = f"""SELECT language_constant.resource_name FROM language_constant
WHERE language_constant.name LIKE '{lang_name}' LIMIT 1"""
response = googleads_service.search(
customer_id=customer_id, query=query
)
lang_resource = response.results[0].language_constant
criterion = criterion_op.create
criterion.campaign = campaign_id
criterion.language = lang_resource.resource_name
return criterion_op
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/1194c4a4-c567-4896-900d-2122c7fdd74fn%40googlegroups.com.