I'm trying to run the code sample at 
https://developers.google.com/google-ads/api/docs/keyword-planning/generate-historical-metrics?hl=en
 
and it doesn't work.

It's not actually a code sample, instead it references another code sample 
https://developers.google.com/google-ads/api/docs/keyword-planning/generate-forecast-metrics
 and 
says what needs to be changed. "Make a request to 
KeywordPlanService.GenerateHistoricalMetrics after creating the 
KeywordPlan" and then to "Iterate through each of the 
KeywordPlanHistoricalMetrics and display each of the metrics."

It apparently needs more changes than that, because if I run it, it 
executes the historical metrics query successfully and I get a response. 
Then when I try to iterate through the KeywordPlanHistoricalMetrics 
objects, it reaches the line

for i, forecast in enumerate(response.keyword_forecasts):

and it crashes with this error:
python-BaseException
Traceback (most recent call last):
File 
"/home/jason/repo/heimdall/.venv/lib/python3.7/site-packages/proto/message.py", 
line 600, in *getattr*
pb_type = self._meta.fields[key].pb_type
KeyError: 'keyword_forecasts'

This response object is opaque and I can't tell what's in it at all. It 
doesn't seem to have a field called "keyword_forecasts".

This would work out better if you actually provided a working code sample 
for historical metrics instead of referring to the one for forecast 
metrics, since you're leaving out some of the details needed to get it to 
work.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/1a5e6176-dec8-46af-82c0-95a6853e5023n%40googlegroups.com.
  • Co... Jason Tiscione
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to