【问题标题】:Authenticating with Adwords Googleads without local storage在没有本地存储的情况下使用 Adwords Googleads 进行身份验证
【发布时间】:2018-08-29 20:16:17
【问题描述】:

因此很难找到这方面的文档或教程。我们正处于一个使用 Python (Django) 的项目的开始阶段,并且正在整合几个概念验证函数。

我正在尝试使用 googleads python 库通过 adwords api 进行身份验证。但目前,我只能找到从本地存储中提取 adwords 凭据的示例:

adwords.AdWordsClient.LoadFromStorage()

问题是,我们将在数据库中存储 api 密钥等,因为多个 adwords 管理器可能正在使用该工具。因此,将凭据存储在静态文件中并不理想(看起来 loadfromstorage 的凭据存储在 yaml 文件中,尽管我在查找详细信息时遇到了一些麻烦)。

有没有人有一个“即时”设置 adwords 客户端的好例子,知道 api 密钥并根据需要生成其他项目。

让我知道你们的想法。

谢谢!

【问题讨论】:

    标签: django python-3.x google-ads-api django-1.9


    【解决方案1】:

    长版在这里here

    tl;博士

    #in case you need proxy to access the internet
    prxx = common.ProxyConfig.Proxy(YOUR_PROXY_HOST, YOUR_PROXY_PORT )
    proxy_config = common.ProxyConfig(http_proxy=prxx,https_proxy=prxx,disable_certificate_validation=True)
    
    #init oauth refresh token client
    oauth_client = oauth2.GoogleRefreshTokenClient(client_id=YOUR_GOOGLE_CLIENT_ID, client_secret=YOUR_GOOGLE_CLIENT_SECRET,refresh_token=YOUR_GOOGLE_REFRESH_TOKEN, proxy_config=proxy_config )
    
    #adwords client
    adwords_client = adwords.AdWordsClient(YOUR_DEVELOPER_TOKEN,oauth_client, user_agent=YOUR_USER_AGENT, client_customer_id=YOUR_CLIENT_CUSTOMER_ID, proxy_config=proxy_config)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-03
      • 1970-01-01
      相关资源
      最近更新 更多