Error with GenerateKeywordHistoricalMetricsRequest
KrishnaM313 opened this issue · 2 comments
I am following the code given here https://developers.google.com/google-ads/api/samples/generate-historical-metrics#python to get historical metrics for certain keywords. However, I am getting an error when I try to set keywords, with the line request.keywords = ["mars cruise", "cheap cruise", "jupiter cruise"]
used in the example.
AttributeError: Assignment not allowed to message, map, or repeated field "keywords" in protocol message object.
When I comment out the line in question, these are my logs: https://pastebin.com/aqEN4xY6
How do I resolve this?
it should be
request.keywords.extend('mars')
request.keywords.extend("cheap cruise')
request.keywords.extend("jupiter cruise")
@KrishnaM313 thanks for the question.
My guess is that you have use_proto_plus
set to False. When that's true, this type of assignment isn't possible. If you set it to True, then the example should execute without any changes.
If you want to continue with use_proto_plus
set to False, then you can assign these values as such:
request.keywords.extend(["mars cruise", "cheap cruise", "jupiter cruise"])