如何在Google Ads Python中使用语言常量?

huangapple go评论66阅读模式
英文:

How can I use Language Constant in google ads python?

问题

我有一个从Google广告API中提供关键词建议的代码。

在这段代码中,我有一个选择语言并使用语言ID的部分,但在Google Ads API的新版本(V13)中,它已被弃用并移除。

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

现在LanguageConstantService的替代方法是什么?
如何在我的请求中设置语言?

我在以下链接找到了我的代码:
https://www.danielherediamejias.com/python-keyword-planner-google-ads-api/


错误信息是:

ValueError: 指定的服务LanguageConstantService在Google Ads API v13中不存在。

英文:

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.

答案1

得分: 2

我发现我们可以使用GoogleAdsService来实现:

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

查看这个链接:

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

英文:

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

huangapple
  • 本文由 发表于 2023年6月2日 12:53:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76387219.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定