I am trying to use the google Double click bid manager (DBM) API, to download reports, I am trying to make this automatic without manual authentication, but all I can find is the GitHub repo for DBM samples https://github.com/googleads/googleads-bidmanager-examples
This sample opens up a browser for manual authentication.
Is there any way to do it automatically using python?
You can use a Google Cloud Platform service account for authentication as well.
- Create service account and create/download the JSON key
- Add the service account to the DBM (now Display & Video 360) account you want to access
- Use the Python Google API client library (also see this Google DV360 tutorial, the authentication part is the same):
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