Alternate to yaml file

18 views
Skip to first unread message

shivankit sharma

unread,
Oct 23, 2018, 7:05:22 PM10/23/18
to AdWords API and Google Ads API Forum
While i have a working code, I am trying to run it in an Azure Spark cluster. This creates an issue since i cannot use the yaml based credentials. How can the code be modified to run by keeping the credentials within the script itself rather than pulling from the yaml file

REPORT_TYPE = 'VIDEO_PERFORMANCE_REPORT'

def main(adwords_client):
  report_downloader = adwords_client.GetReportDownloader(version='v201809')

  # Create report definition.
  report = {
      'reportName': 'VIDEO_PERFORMANCE_REPORT',
      'dateRangeType': 'LAST_7_DAYS',
      'reportType': 'VIDEO_PERFORMANCE_REPORT',
      'downloadFormat': 'CSV',
      'selector': {
          'fields': ['Date','AdGroupStatus','AdGroupName', 'CreativeStatus','AccountCurrencyCode','VideoViews','AverageCpv','Cost','Impressions', 'VideoQuartile25Rate','VideoQuartile50Rate','VideoQuartile75Rate','VideoQuartile100Rate', 'Clicks','AdGroupId']
      }
  }

  # Print out the report as a string
  print (report_downloader.DownloadReportAsString(
      report, skip_report_header=False, skip_column_header=False,
      skip_report_summary=False, include_zero_impressions=True))


if __name__ == '__main__':
  adwords_client = adwords.AdWordsClient(DEVELOPER_TOKEN, oauth2_client, USER_AGENT,CLIENT_CUSTOMER_ID)
  main(adwords_client)

 Thanks
Shiv

Peter Oliquino (AdWords API Team)

unread,
Oct 24, 2018, 2:19:08 AM10/24/18
to AdWords API and Google Ads API Forum
Hi Shiv,

Since you are using a client library for your operations, our recommendation would be to refer to the yaml file in accordance to the current standard. With this, we can ensure the security of your credentials as it will avoid being maintained anywhere in your code.

However, should you require further assistance, you can get in touch with the client library owners via this link as they are better equipped to assist you regarding this matter.

Best regards,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages