GithubHelp home page GithubHelp logo

googleads-bidmanager-examples's Introduction

Samples for the DoubleClick Bid Manager API

This repository contains a collection of samples for interacting with the DoubleClick Bid Manager API. Documentation on this API can be found here.

The following samples are available:

  • java a collection of Java samples.
  • php a collection of PHP samples.
  • python a collection of Python samples.

Please refer to the README.md file inside each directory for installation instructions.

googleads-bidmanager-examples's People

Contributors

anashoommen avatar deanlukies avatar dependabot[bot] avatar jimper avatar tmulchay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

googleads-bidmanager-examples's Issues

dbm_sample.yaml

Should there be a dbm_sample.yaml file within this repository? It is required to hold the client_id and client_secret but I don't see it in this repository.

Thanks!
Ryan

createquery() Request Body - Which configurations work?

Hello,

I am trying to download reports from the DBM API. I am using createquery() to configure the query for the report, this works well for general reports with metrics like impressions, clicks and costs. I wanted to ask if there is any documentation available on which combinations of report types, groupBys, filters and metrics work with one another?
Unfortunately the only error the DBM API returns when there is a problem with the query configuration is "backendError", "Woops. We are currently having some issues.".

For example I am trying to get a report with the metric "METRIC_COOKIE_REACH_AVERAGE_IMPRESSION_FREQUENCY" by using the following request body:

{
    "kind":"doubleclickbidmanager#query",
    "metadata":{
       "title":"[API] Title",
       "dataRange":"YEAR_TO_DATE",
       "format":"CSV",
       "sendNotification":false
    },
    "params":{
       "type":"TYPE_REACH_AND_FREQUENCY",
       "groupBys":[
          "FILTER_INSERTION_ORDER"
       ],
       "filters":[
            {
                "type": "FILTER_PARTNER",
                "value": ""
            },
            {
                "type": "FILTER_ADVERTISER",
                "value": ""
            },
            {
                "type": "FILTER_ADVERTISER",
                "value": ""
            },
            {
                "type": "FILTER_ADVERTISER",
                "value": ""
            },
            {
                "type": "FILTER_MEDIA_PLAN",
                "value": ""
            }
       ],
       "metrics":[
            "METRIC_COOKIE_REACH_AVERAGE_IMPRESSION_FREQUENCY"
       ]
    },
    "schedule":{
        "endTimeMs":"0",
        "frequency":"ONE_TIME",
        "nextRunTimezoneCode":"Europe/Berlin"
     }
}

(I have removed the filter values because of privacy concerns, but I have confirmed that they work with other report types and metrics. )

createquery() returns the following error:

{
   "error":{
      "errors":[
         {
            "domain":"global",
            "reason":"backendError",
            "message":"Woops. We are currently having some issues."
         }
      ],
      "code":503,
      "message":"Woops. We are currently having some issues."
   }
}

Why doesn't this query configuration work? Is there any way to get a more meaningful error message?

Any help would be greatly appreciated.

Best regards,
Benedikt Miller

TrueView Examples

I'm interested in creating new and updating existing TrueView line items.
Any estimates to get a support for TrueView and see an example of updating targeting URLs?

DownloadOrderDetails

Is there an available service to retrieve order details, similar to the service available for downloading line items?

POST https://www.googleapis.com/doubleclickbidmanager/v1/lineitems/downloadlineitems

Thanks

create query - httplib2.RedirectMissingLocation: Redirected but the response is missing a Location: header.

Hi,

I'm getting this error when I create a new query. Any ideas on how to fix this?

httplib2.RedirectMissingLocation: Redirected but the response is missing a Location: header.

query_test = {
    "kind": "doubleclickbidmanager#query",
    "metadata": {
        "dataRange": "LAST_30_DAYS",
        "format": "CSV",
        "googleCloudStoragePathForLatestReport": "",
        "googleDrivePathForLatestReport": "",

        "locale": "",
        "reportCount": 0,
        "running": False,
        "sendNotification": False,
        "shareEmailAddress": [
            ""
        ],
        "title": ""
    },
    "params": {
        "filters": [
            {}
        ],
        "groupBys": [
            "FILTER_ADVERTISER",
            "FILTER_ADVERTISER_CURRENCY",
            "FILTER_CREATIVE",
            "FILTER_CM_PLACEMENT_ID",
            "FILTER_DATE"

        ],
        "includeInviteData": False,
        "metrics": [
            "METRIC_BILLABLE_IMPRESSIONS",
            "METRIC_IMPRESSIONS",
            "METRIC_CLICKS",
            "METRIC_CLIENT_COST_ADVERTISER_CURRENCY",
            "METRIC_PLATFORM_FEE_ADVERTISER",
            "METRIC_PLATFORM_FEE_RATE",
            "METRIC_DATA_COST_ADVERTISER",
            "METRIC_CPM_FEE1_ADVERTISER",
            "METRIC_TOTAL_MEDIA_COST_ADVERTISER"
        ],
        "type": "TYPE_ACTIVE_GRP"
    },

    "schedule": {

        "frequency": "DAILY",
        "nextRunTimezoneCode": ""
    },
    "timezoneCode": "Europe/London"
}
createdQuery = service.queries().createquery(body=query_test).execute()

Google_Service_DoubleClickBidManager_DownloadLineItemsRequest Not Found

A couple of days ago i was looking in to our Google Display & Video 360 reports. I noticed they stopped reporting data because of the error:
Class 'Google_Service_DoubleClickBidManager_DownloadRequest' not found

After some investigation i found your examples which were using 'Google_Service_DoubleClickBidManager_DownloadLineItemsRequest'.

I probably missed some updates and updated my code according to the line item example in this repo.
After updating my code i got the same error with the updated class name.

I have imported the required packages and am using Laravel so they are automaticly added to the autoloader.
afbeelding

Is this example outdated?

Some extra info about my project;
I manage a project which pull data from many different marketing platforms.
For Google DV 360 we pull all insertion orders, line items and creatives in seperate calls and save them to our database.
After pulling all dimension data we pull some metrics like impressions, clicks and spend.
All this data used to be pulled through the Doubleclick manager package from the google php client.

I can supply some code samples if required, i would have to recreate them after migrating the implementation to the Google Display & Video php client.
The DV360 client does not fullfill my needs because it prepares zipped CSV documents which are hard to work with in code.

Thanks in advance.

Doubleclick for bid manager CreateQuery stopped working

I have been using the following query for the CreateQuery API in Doubleclick for Bid Manager successfully. But it has stopped working since first day of September with the error:
[Google_Service_Exception] { "error": { "errors": [ { "domain": "global", "reason": "invalid", "message": "Invalid Value", "locationType": "other", "location": "params.filter.value" } ], "code": 400, "message": "Invalid Value" } }
I have only one filter for the request. Its FILTER_ADVERTISER without value. So that way i can download all clients report in partner. But that way not working anymore first day of September.

There is nothing about it why its not working ? :(

GoogleBidManager RunQuery Error

Hello,

I'm creating a python function that will run on Google Cloud Functions in order to pull data from DBM.

I was initially using the createquery function, which lets me create the query and send it in the request. However, I want to switch it to start using runquery instead, due to the limitation of the API regarding certain dimensions and metrics combinations.

I have created a query on DBM and I want to have the cloud function run it every time I need it and I'll use the listreports API to get the latest report.

My main issue is that when I'm trying to use the runquery function I'm always getting the following error:
textPayload: "Traceback (most recent call last): File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker.py", line 383, in run_background_function _function_handler.invoke_user_function(event_object) File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker.py", line 217, in invoke_user_function return call_user_function(request_or_event) File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker.py", line 214, in call_user_function event_context.Context(**request_or_event.context)) File "/user_code/main.py", line 127, in create_google_bidmanager_report bidmanager_report(doubleclick_bid_manager, day_start, day_end) File "/user_code/main.py", line 26, in bidmanager_report response = doubleclick_bid_manager.queries().runquery(body=data, queryId=651937704).execute() File "/env/local/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper return wrapped(*args, **kwargs) File "/env/local/lib/python3.7/site-packages/googleapiclient/http.py", line 856, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: <HttpError 503 when requesting https://www.googleapis.com/doubleclickbidmanager/v1/query/651937704? returned "Woops. We are currently having some issues."> "

Here is my python code that I'm using:

from google.cloud import datastore
from oauth2client.service_account import ServiceAccountCredentials
from googleapiclient import discovery
from httplib2 import Http
from datetime import datetime

datastore_client = datastore.Client()


def create_credentials():
    scopes = ['https://www.googleapis.com/auth/doubleclickbidmanager']

    credentials = ServiceAccountCredentials.from_json_keyfile_name('JSON_KEY_FILE.json', scopes=scopes)

    http_auth = credentials.authorize(Http())

    doubleclick_bid_manager = discovery.build('doubleclickbidmanager', 'v1', http=http_auth)

    return doubleclick_bid_manager


def bidmanager_report(doubleclick_bid_manager, day_start, day_end):
    data = {
        "dataRange": "PREVIOUS_DAY"
    }
    response = doubleclick_bid_manager.queries().runquery(queryId=651937704, body=data).execute()


def create_google_bidmanager_report(data, context):
    doubleclick_bid_manager = create_credentials()

    today = datetime.now()
    day_start = datetime(year=today.year, month=today.month, day=today.day, hour=0, minute=0, second=0)
    day_end = datetime(year=today.year, month=today.month, day=today.day, hour=23, minute=59, second=59)

    bidmanager_report(doubleclick_bid_manager, day_start, day_end)

The error happens at this line:
response = doubleclick_bid_manager.queries().runquery(queryId=651937704, body=data).execute()

The error as shown above in the error log is:
Woops. We are currently having some issues.

Is there any other way to run a saved query or should I revert back to create query?

I try to create a query

The response:

body = {
"kind": "doubleclickbidmanager#query",
"metadata": {
"dataRange": "LAST_14_DAYS",
"format": "CSV",
"locale":"es",
"title": "API query"
},
"params": {
"type":"TYPE_GENERAL",
"filters":[
{
"type":"FILTER_PARTNER",
"value":""
}
],
"metrics":[
"METRIC_CLICKS"
]
},
"schedule": {
"frequency": "ONE_TIME"
}
}

googleapiclient.errors.HttpError: <HttpError 503 when requesting https://www.googleapis.com/doubleclickbidmanager/v1/query?alt=json returned "Woops. We are currently having some issues.">

BidManager API: Response: Request had insufficient authentication scopes.

I have used client_secrets.json to fetch the reports from dv360. It worked smoothly from my local machine, but while doing the same from the cloud, it throws me the following error:

<HttpError 403 when requesting https://doubleclickbidmanager.googleapis.com/doubleclickbidmanager/v1.1/query/XXXXXXX?alt=json returned "Request had insufficient authentication scopes.". Details: "Request had insufficient authentication scopes.">

Here is my code:

class DV360Reports:

    def __init__(self, query_id, outputdirectory, cfg, reportWindow = 12):

        self.cfg = cfg
        self.arguments = self.get_arguments()
        self.outputdir = outputdirectory
        self.reportWindow = reportWindow
        self.apiSecrets = cfg.path["bidManagerSecrets"]
        #print(self.outputdir)



    def get_arguments(self, argv = sys.argv, desc = __doc__, parents=None):

        parent_parsers = [tools.argparser]
        if parents:
            parent_parsers.extend(parents)

        parser = argparse.ArgumentParser(
            description=desc,
            formatter_class=argparse.RawDescriptionHelpFormatter,
            parents=parent_parsers)
        return parser.parse_args(argv[1:])


    def setup(self, flags, secretsPath = None):

        if secretsPath == None:
            secretsPath = self.apiSecrets

        API_NAME = 'doubleclickbidmanager'
        API_VERSION = 'v1.1'
        CREDENTIAL_STORE_FILE = API_NAME + '.dat'

        credentials = self.load_application_default_credentials()

        if credentials is None:
            client_secrets = secretsPath
            storage = oauthFile.Storage(CREDENTIAL_STORE_FILE)
            credentials = self.load_user_credentials(client_secrets, storage, flags)

        # Authorize HTTP object with the prepared credentials.
        http = credentials.authorize(http=httplib2.Http())

        # Construct and return a service object via the discovery service.
        return discovery.build(API_NAME, API_VERSION, http=http)


    def load_application_default_credentials(self):
        
        API_SCOPES = ['https://www.googleapis.com/auth/doubleclickbidmanager']

        try:
            credentials = client.GoogleCredentials.get_application_default()
            return credentials.create_scoped(API_SCOPES)

        except client.ApplicationDefaultCredentialsError:
            pass


    def load_user_credentials(self,client_secrets, storage, flags):

        API_SCOPES = ['https://www.googleapis.com/auth/doubleclickbidmanager']

        flow = client.flow_from_clientsecrets(
            client_secrets,
            scope=API_SCOPES,
            message=tools.message_if_missing(client_secrets))

        credentials = storage.get()
        if credentials is None or credentials.invalid:
            credentials = tools.run_flow(flow, storage, flags)

        return credentials


    def performDownload(self, query_id, report_window = None, output_dir = None):

        if report_window == None:
            report_window = self.reportWindow

        if report_window != None:
            self.reportWindow = report_window


        doubleclick_bid_manager = self.setup(self.arguments)

        if output_dir != None:

            self.outputdir = output_dir

        if output_dir == None:
            output_dir = self.outputdir

        if query_id:
            query = (
            
            try:

                if (self.is_in_report_window(query['metadata']['latestReportRunTimeMs'],
                                        report_window)):
                                        if not os.path.isabs(output_dir):
                                            output_dir = os.path.expanduser(output_dir)

                                        report_url = query['metadata']['googleCloudStoragePathForLatestReport']
                                        output_file = '%s/%s.csv' % (output_dir, query['queryId'])
                                        with open(output_file, 'wb') as output:
                                            with closing(urlopen(report_url)) as url:
                                                output.write(url.read())
                                        return pd.read_csv(output_file,low_memory=False,encoding= 'unicode_escape')
                else:
                    print("Comes under else")
                    print('No reports for queryId "%s" in the last %s hours.' %
                        (query['queryId'], report_window))

            except KeyError:
                print('No report found for queryId "%s".' % query_id)

        else:
            response = doubleclick_bid_manager.queries().listqueries().execute()
            print('Id\t\tName')
            if 'queries' in response:
                self.print_queries(response)
                # Then everything else
                while 'nextPageToken' in response and response['nextPageToken']:
                    
                    response = doubleclick_bid_manager.queries().listqueries(
                        pageToken=response['nextPageToken']).execute()
                    self.print_queries(response)
            else:
                print('No queries exist.')

        return False


    


    def print_queries(self, response):

        for q in response['queries']:
            print('%s\t%s' % (q['queryId'], q['metadata']['title']))


    def is_in_report_window(self, run_time_ms, report_window):
        report_time = datetime.fromtimestamp(int((run_time_ms)) / 1000)
        earliest_time_in_range = datetime.now() - timedelta(hours=report_window)
        return report_time > earliest_time_in_range

When I call performDownload, I get the error as mentioned above. Does anyone know what am I doing wrong? Good thing is that this same script works amazingly in my local system, but doesn't happen to run when running from google cloud platform instance.

Doubleclick bid manager - CreateQuery error

Hi
We are using the DoubleClick bid manager api test page to develop our api. Got stuck with a a "Whoops. We are currently having some issues". Here is the Query and the return result.
Have you came across this? Could you share with me an (any) example Query that actually works (so that we can eliminate any environment/setting issues

api Query

{
"kind": "doubleclickbidmanager#query",
"metadata": {
"title": "iuj",
"dataRange": "YEAR_TO_DATE",
"format": "CSV",
"sendNotification": false
},
"params": {
"type": "TYPE_REACH_AND_FREQUENCY",
"groupBys": [
"FILTER_ADVERTISER"
],
"filters": [
{
"type": "FILTER_PARTNER",
"value": "nn"
},
{
"type": "FILTER_ADVERTISER",
"value": "mm"
}
],
"metrics": [
"METRIC_CLICKS"
]
},
"schedule": {
"endTimeMs": 0,
"frequency": "ONE_TIME",
"nextRunTimezoneCode": "Europe/Berlin"
}
}

RETURN ERROR 503

{
"error": {
"errors": [
{
"domain": "global",
"reason": "internalError",
"message": "Woops. We are currently having some issues."
}
],
"code": 503,
"message": "Woops. We are currently having some issues."
}
}

Google Double Click Bid Manager API Giving 403 Error in Linux VM

Hello,

I'm creating a python DV_360 function to get the data from the DV 360 API. These functions are working well in windows 10 machine though they are not working in the Ubuntu machine and giving 403 forbidden errors.

Traceback (most recent call last):
  File "DV360_1.py", line 134, in <module>
    main(util.setup(args), args.output_directory, QUERY_ID, args.report_window)
  File "DV360_1.py", line 63, in main
    doubleclick_bid_manager.queries().getquery(queryId="670966565").execute())
  File "/home/samsunguk/venv/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/home/samsunguk/venv/lib/python3.7/site-packages/googleapiclient/http.py", line 907, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/doubleclickbidmanager/v1.1/query/670966565?alt=json returned "Insufficient Permission: Request had insufficient authentication scopes.">

main.py:

import argparse
from contextlib import closing
from datetime import datetime
from datetime import timedelta
import os
import sys
from six.moves.urllib.request import urlopen
import util

# Optional filtering arguments.
parser = argparse.ArgumentParser(
    add_help=False,
    description='Downloads a report if it has been created in '
    'the given timeframe.')
parser.add_argument(
    '--output_directory',
    default=(os.path.dirname(os.path.realpath(__file__))),
    help=('Path to the directory you want to '
          'save the report to.'))
parser.add_argument(
    '--query_id',
    default=0,
    type=int,
    help=('The id of a query used to generate a report.'))
parser.add_argument(
    '--report_window',
    default=12,
    type=int,
    help=('The age a report must be in hours at a maximum to '
          'be considered fresh.'))


def main(doubleclick_bid_manager, output_dir, query_id, report_window):
  if query_id:
    # Call the API, getting the latest status for the passed queryId.
    query = (
        doubleclick_bid_manager.queries().getquery(queryId=query_id).execute())
    try:
      # If it is recent enough...
      if (is_in_report_window(query['metadata']['latestReportRunTimeMs'],
                              report_window)):
        if not os.path.isabs(output_dir):
          output_dir = os.path.expanduser(output_dir)

        # Grab the report and write contents to a file.
        report_url = query['metadata']['googleCloudStoragePathForLatestReport']
        output_file = '%s/%s.csv' % (output_dir, query['queryId'])
        with open(output_file, 'wb') as output:
          with closing(urlopen(report_url)) as url:
            output.write(url.read())
        print('Download complete.')
      else:
        print('No reports for queryId "%s" in the last %s hours.' %
              (query['queryId'], report_window))
    except KeyError:
      print('No report found for queryId "%s".' % query_id)
  else:
    # Call the API, getting a list of queries.
    response = doubleclick_bid_manager.queries().listqueries().execute()

    # Print queries out.
    print('Id\t\tName')
    if 'queries' in response:
      # Starting with the first page.
      print_queries(response)
      # Then everything else
      while 'nextPageToken' in response and response['nextPageToken']:
        response = doubleclick_bid_manager.queries().listqueries(
            pageToken=response['nextPageToken']).execute()
        print_queries(response)
    else:
      print('No queries exist.')


def print_queries(response):
  for q in response['queries']:
    print('%s\t%s' % (q['queryId'], q['metadata']['title']))


def is_in_report_window(run_time_ms, report_window):
  """Determines if the given time in milliseconds is in the report window.

  Args:
    run_time_ms: str containing a time in milliseconds.
    report_window: int identifying the range of the report window in hours.

  Returns:
    A boolean indicating whether the given query's report run time is within
    the report window.
  """
  report_time = datetime.fromtimestamp(int((run_time_ms)) / 1000)
  earliest_time_in_range = datetime.now() - timedelta(hours=report_window)
  return report_time > earliest_time_in_range


if __name__ == '__main__':
  args = util.get_arguments(sys.argv, __doc__, parents=[parser])
  # Retrieve the query id of the report we're downloading, or set to 0.
  QUERY_ID = 670966565
  if not QUERY_ID:
    try:
      QUERY_ID = int(
          raw_input('Enter the query id or press enter to '
                    'list queries: '))
    except ValueError:
      QUERY_ID = 0

  main(util.setup(args), args.output_directory, QUERY_ID, args.report_window)`

util.py

import argparse
import os

from googleapiclient import discovery
import httplib2
from oauth2client import client
from oauth2client import file as oauthFile
from oauth2client import tools


API_NAME = 'doubleclickbidmanager'
API_VERSION = 'v1.1'
API_SCOPES = ['https://www.googleapis.com/auth/doubleclickbidmanager']

# Filename used for the credential store.
CREDENTIAL_STORE_FILE = API_NAME + '.dat'


def get_arguments(argv, desc, parents=None):
  """Validates and parses command line arguments.

  Args:
    argv: list of strings, the command-line parameters of the application.
    desc: string, a description of the sample being executed.
    parents: list of argparse.ArgumentParser, additional command-line parsers.

  Returns:
    The parsed command-line arguments.
  """
  # Include the default oauth2client argparser
  parent_parsers = [tools.argparser]

  if parents:
    parent_parsers.extend(parents)

  parser = argparse.ArgumentParser(
      description=desc,
      formatter_class=argparse.RawDescriptionHelpFormatter,
      parents=parent_parsers)
  return parser.parse_args(argv[1:])


def load_application_default_credentials():
  """Attempts to load application default credentials.

  Returns:
    A credential object initialized with application default credentials or None
    if none were found.
  """
  try:
    credentials = client.GoogleCredentials.get_application_default()
    return credentials.create_scoped(API_SCOPES)
  except client.ApplicationDefaultCredentialsError:
    # No application default credentials, continue to try other options.
    pass


def load_user_credentials(client_secrets, storage, flags):
  """Attempts to load user credentials from the provided client secrets file.

  Args:
    client_secrets: path to the file containing client secrets.
    storage: the data store to use for caching credential information.
    flags: command-line flags.

  Returns:
    A credential object initialized with user account credentials.
  """
  # Set up a Flow object to be used if we need to authenticate.
  flow = client.flow_from_clientsecrets(
      client_secrets,
      scope=API_SCOPES,
      message=tools.message_if_missing(client_secrets))

  # Retrieve credentials from storage.
  # If the credentials don't exist or are invalid run through the installed
  # client flow. The storage object will ensure that if successful the good
  # credentials will get written back to file.
  credentials = storage.get()
  if credentials is None or credentials.invalid:
    credentials = tools.run_flow(flow, storage, flags)

  return credentials


def setup(flags):
  """Handles authentication and loading of the API.

  Args:
    flags: command-line flags obtained by calling ''get_arguments()''.

  Returns:
    An initialized service object.
  """
  # Load application default credentials if they're available.
  credentials = load_application_default_credentials()

  # Otherwise, load credentials from the provided client secrets file.
  if credentials is None:
    # Name of a file containing the OAuth 2.0 information for this
    # application, including client_id and client_secret, which are found
    # on the Credentials tab on the Google Developers Console.
    client_secrets = os.path.join(os.path.dirname(__file__),
                                  'client_secrets.json')
    storage = oauthFile.Storage(CREDENTIAL_STORE_FILE)
    credentials = load_user_credentials(client_secrets, storage, flags)

  # Authorize HTTP object with the prepared credentials.
  http = credentials.authorize(http=httplib2.Http())

  # Construct and return a service object via the discovery service.
  return discovery.build(API_NAME, API_VERSION, http=http)

Error creating query - **TypeError: method() takes 1 positional argument but 2 were given**

query_test = {
    "kind": "doubleclickbidmanager#query",
    "metadata": {
        "dataRange": "ALL_TIME",
        "format": "CSV",
        "googleCloudStoragePathForLatestReport": "",
        "googleDrivePathForLatestReport": "",
        "latestReportRunTimeMs": "",
        "locale": "",
        "reportCount": 0,
        "running": False,
        "sendNotification": False,
        "shareEmailAddress": [
            ""
        ],
        "title": ""
    },
    "params": {
        "filters": [
            {}
        ],
        "groupBys": [
            "FILTER_ACTIVE_VIEW_EXPECTED_VIEWABILITY"
        ],
        "includeInviteData": False,
        "metrics": [
            "METRIC_ACTIVE_VIEW_AUDIBLE_VISIBLE_ON_COMPLETE_IMPRESSIONS"
        ],
        "type": "TYPE_ACTIVE_GRP"
    },
    "queryId": "",
    "reportDataEndTimeMs": "",
    "reportDataStartTimeMs": "",
    "schedule": {
        "endTimeMs": "",
        "frequency": "DAILY",
        "nextRunMinuteOfDay": 0,
        "nextRunTimezoneCode": ""
    },
    "timezoneCode": ""
}
createdQuery = service.queries().createquery(query_test)
print(createdQuery)

Issue with the method getLatestReport

Hi ,

I am facing one issue with the getLatestReport method which is providing the URL for the second latest report not the recent one. Does anybody facing the same issue. Any solution will be appreciated.

More clarification on storage buckets permissions for 3rd party devs

Hi @jimper, we’ve been chatting with DBM Support but I suspect there’s something being lost in translation as I think the issue is some clarification needed for our use of the DBM API on behalf of our ad clients. We’d like to figure out if this is a problem with the DBM API or transition and whether we are even following the correct methodology! We run reports using our customers’ credentials for reports on DBM and then we analyze the resulting CSV allowing them to do more work in other Google products. This worked great until around July 17-20 and then the report downloading started taking a long time.

I’m guessing this is due to the move you announced on July 27. Reading through the docs, it is unclear for a service like ours exactly who owns the Google Storage Bucket, is it created by the client in this case and do they need to give our Google Cloud project service account access to that bucket, or can we access it as before with the credentials that they’ve given us? Not quite the forum for this question, but I hope you can help us get some sort of clarity so we can fix. Contact me here or on twitter @dups

Default branch is now `main`

As part of Google’s ongoing efforts to foster inclusive language, we’ve changed the default branch of this project to main. We encourage contributors to do the same for their forks and local development environments in order to minimize issues when creating pull requests.

get_latest_reports.py overflowError

Hello i am trying to download a report but i keep getting an overflow error saying python int too large to convert to C long. I am working on a windows machine using vs code. Any help with this?

Creating new line items via uploadlineitems

Can the uploadlineitems create new line items? As far as I have tested, it is only managed to edit existing line items. However, I need to programatically create new ones

Insufficient Permission Error while executing the code on GCP VM Instance

I have been trying to execute GCP Bid manager API in GCP virtual instance but I get this error:

HttpError 403 when requesting https://********** returned "Insufficient Permission: Request had insufficient authentication scopes.

Tried to resolve it using:

gcloud auth login

But this doesn't work as well. I have all the credential json file with the name clien_secrets.json.

get_latest_report.py giving an error

After creating a client_id, client secret in the google dbm api console and I tried to several times the "get_latest_report.py" but I get the following message:
Log into the Google Account you use to access your DBM accountand go to the following URL:
https://accounts.google.com/o/oauth2/v2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdoubleclickbidmanager&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=None&access_type=offline

After login into the account and pasting the URL above, I get an error message 401 "invalid_client"
How would I get the code needed to continue the execution of this python sample?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.