I have a code that give me suggestion of keywords from google ads api.

in this code I have a section that select language with language id but in new version of Google Ads API (V13) it's deprecated and removed.

language_rn = client.get_service(         "LanguageConstantService"     ).language_constant_path(language_id) 

What is the alternative of LanguageConstantService Now? How can I set Language in my request?

I find my code from link below: https://www.danielherediamejias.com/python-keyword-planner-google-ads-api/


The Error is:

ValueError: Specified service LanguageConstantService does not exist in Google Ads API v13.

Tag:google-ads-api, python

2 comments.

  1. Ali Esmaeili

    I found out we can use GoogleAdsService for it:

    language_rn = client.get_service("GoogleAdsService").language_constant_path( language_id )

    check this out:

    https://developers.google.com/google-ads/api/samples/generate-keyword-ideas

  2. paeduardo

    """Try this:"""

    campaign_criterion_service = client.get_service("CampaignCriterionService") # Create the campaign criterion operation campaign_criterion_operation = client.get_type( "CampaignCriterionOperation" ) campaign_criterion = campaign_criterion_operation.create campaign_criterion.campaign = campaign_resource_name #list of language constants: https://developers.google.com/adwords/api/docs/appendix/codes-formats#expandable-7 campaign_criterion.language.language_constant=language_constant campaign_criterion_response = campaign_criterion_service.mutate_campaign_criteria( customer_id=customer_id, operations=[campaign_criterion_operation] ) print( "Campaign criterion with resource name " f'"{campaign_criterion_response.results[0].resource_name}" was ' "modified." )

Add a new comment.