在python中使用DoubleClick Bid Manager API的HttpEroor 500后端错误和HttpError 403 [英] HttpEroor 500 Backend Error and HttpError 403 using DoubleClick Bid Manager API in python

查看:109
本文介绍了在python中使用DoubleClick Bid Manager API的HttpEroor 500后端错误和HttpError 403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在遵循示例

I need to create and run some queries as well as get the last reports via DoubleClick Bid Manager API in python, after following the example get_last_report.py in Github step by step, I always got an HttpError 500, like:

Traceback (most recent call last):
  File "dbm.py", line 202, in <module>
    main(util.setup(args), args.output_directory, QUERY_ID, args.report_window)
  File "dbm.py", line 154, in main
    response = doubleclick_bid_manager.queries().listqueries().execute()
  File "//anaconda3/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "//anaconda3/lib/python3.7/site-packages/googleapiclient/http.py", line 856, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 500 when requesting https://www.googleapis.com/doubleclickbidmanager/v1.1/queries?alt=json returned "Backend Error">

当我尝试运行示例时, download_line_items .py ,我又遇到了另一个错误HttpError 403:

Also when I tried to run the example download_line_items.py, I got another error HttpError 403:

Traceback (most recent call last):
  File "download_LI.py", line 81, in <module>
    main(util.setup(args), path, request_body)
  File "download_LI.py", line 57, in main
    handler.write(request.execute()['lineItems'].encode('utf-8'))
  File "//anaconda3/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "//anaconda3/lib/python3.7/site-packages/googleapiclient/http.py", line 856, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/doubleclickbidmanager/v1.1/lineitems/downloadlineitems?alt=json returned "You are not authorized to use DoubleClick Bid Manager API. Please contact dbm-support@google.com.">

我已经尝试过其他客户端机密文件,但是没有用.任何帮助将不胜感激.

I already tried different client secret files, but it didn't work. Any help will be appreciated.

推荐答案

此错误非常模糊,但始终必须与请求正文中的微小错误有关.

This error is very vague, but it always has to be with a tiny error in the request body.

针对将来的用户:

仔细检查如何创建查询正文:

Check carefully how to create the query body:

https://developers.google.com/bid-manager/v1.1/queries#resource

我不止一次浪费了宝贵的调试时间……最后是:

More than one time I lost miserable hours debugging... and in the end it was:

  • 键名中的错字
  • 一个额外的空格,例如:.... "frequency": "ONE_TIME "

希望它会有所帮助:)

这篇关于在python中使用DoubleClick Bid Manager API的HttpEroor 500后端错误和HttpError 403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆