首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在python中使用双击投标管理器(DBM) API

问如何在python中使用双击投标管理器(DBM) API
EN

Stack Overflow用户
提问于 2021-04-27 17:54:05
回答 1查看 154关注 0票数 0

我正在尝试使用谷歌双击投标管理器( DBM )应用程序接口,以下载报告,我试图使此自动无需手动身份验证,但我能找到的是DBM示例的GitHub存储库https://github.com/googleads/googleads-bidmanager-examples此示例打开一个浏览器进行手动身份验证。有没有办法使用python自动完成这项工作?

EN

回答 1

Stack Overflow用户

发布于 2021-09-26 09:29:47

您也可以使用Google Cloud Platform服务帐户进行身份验证。

  • 创建服务帐户并创建/下载JSON密钥
  • 将服务帐户添加到要访问的DBM (现在显示和视频360)帐户
  • 使用Python Google API客户端库(另请参阅this Google DV360 tutorial,身份验证部分相同):

代码语言:javascript
复制
from googleapiclient import discovery
from oauth2client.service_account import ServiceAccountCredentials

# SETTINGS - GOOGLE GENERAL
GOOGLE_JSON_KEYFILE = "<your-keyfile>.json" # Google Cloud Platform Service Account JSON keyfile

# SETTINGS - GOOGLE DV360 API
GOOGLE_DV360_API_VERSION = 'v1'
GOOGLE_DV360_API_SCOPES = ['https://www.googleapis.com/auth/display-video']

# Google D&V360 API service
def get_dv360_service():
    credentials = ServiceAccountCredentials.from_json_keyfile_name(
        GOOGLE_JSON_KEYFILE,
        scopes=GOOGLE_DV360_API_SCOPES)

    return discovery.build('displayvideo', GOOGLE_DV360_API_VERSION, credentials=credentials, cache_discovery=False)

dv360_service = get_dv360_service()

#dv360_service.-> get your reports
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67280816

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档