How to use the googleads.ad_manager.AdManagerClient.LoadFromStorage function in googleads

To help you get started, we’ve selected a few googleads examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleads / googleads-python-lib / examples / ad_manager / v201908 / creative_set_service / update_creative_set.py View on Github external
# Update the creative sets on the server.
    creative_sets = creative_set_service.updateCreativeSet(updated_created_sets)

    # Display results.
    for creative_set in creative_sets:
      print(('Creative set with ID "%s", master creative ID "%s", and '
             'companion creative IDs {%s} was updated.')
            % (creative_set['id'], creative_set['masterCreativeId'],
                ','.join(creative_set['companionCreativeIds'])))
  else:
    print('No creative sets found to update.')


if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client, CREATIVE_SET_ID, COMPANION_CREATIVE_ID)
github googleads / googleads-python-lib / examples / ad_manager / v201905 / reconciliation_report_service / get_reconciliation_report_for_last_billing_period.py View on Github external
for reconciliation_report in response['results']:
        # Print out some information for each reconciliation report.
        print(
            'Reconciliation report with ID "%d" and start date "%s" was found.'
            '\n' % (reconciliation_report['id'],
                    last_month.strftime('%Y-%m-01')))
      statement.offset += statement.limit
    else:
      break

  print('\nNumber of results found: %s' % response['totalResultSetSize'])


if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client)
github googleads / googleads-python-lib / examples / ad_manager / v201908 / cms_metadata_service / get_cms_metadata_values_for_key.py View on Github external
# Print out some information for each value.
        print(('CMS metadata value with Id %d and name "%s", associated with '
               'the CmsMetadataKey with id %d and name "%s", was found.\n') %
              (cms_metadata_value['cmsMetadataValueId'],
               cms_metadata_value['valueName'], cms_metadata_value['key']['id'],
               cms_metadata_value['key']['name']))
      statement.offset += statement.limit
    else:
      break

  print('\nNumber of results found: %s' % response['totalResultSetSize'])


if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client, CMS_METADATA_KEY_NAME)
github googleads / googleads-python-lib / examples / ad_manager / v201902 / team_service / create_teams.py View on Github external
'hasAllInventory': 'false',
        'teamAccessType': 'READ_WRITE'
    }
    teams.append(team)

  # Add Teams.
  teams = team_service.createTeams(teams)

  # Display results.
  for team in teams:
    print('Team with ID "%s" and name "%s" was created.'
          % (team['id'], team['name']))

if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client)
github googleads / googleads-python-lib / examples / ad_manager / v201808 / suggested_ad_unit_service / get_highly_requested_suggested_ad_units.py View on Github external
if 'results' in response and len(response['results']):
      for suggested_ad_unit in response['results']:
        # Print out some information for each suggested ad unit.
        print(
            'Suggested ad unit with ID "%s" and num requests "%d" was found.\n'
            % (suggested_ad_unit['id'], suggested_ad_unit['numRequests']))
      statement.offset += statement.limit
    else:
      break

  print '\nNumber of results found: %s' % response['totalResultSetSize']


if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client, NUM_REQUESTS)
github googleads / googleads-python-lib / examples / ad_manager / v201908 / custom_targeting_service / update_custom_targeting_values.py View on Github external
# Display results.
      for value in values:
        print('Custom targeting value with id "%s", name "%s", and display'
              ' name "%s" was updated.'
              % (value['id'], value['name'], value['displayName']))
      statement.offset += statement.limit
    else:
      break

  if response['totalResultSetSize'] == 0:
    print('No custom targeting values were updated.')


if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client, CUSTOM_TARGETING_KEY_ID)
github googleads / googleads-python-lib / examples / ad_manager / v201905 / forecast_service / get_availability_forecast_for_line_item.py View on Github external
contending_line_items = getattr(forecast, 'contentingLineItems', [])

  # Display results.
  print('%s %s matched.' % (matched, forecast['unitType'].lower()))
  print('%s%% %s available.' % (
      available_percent, forecast['unitType'].lower()))
  print('%d contending line items.' % len(contending_line_items))

  if 'possibleUnits' in forecast and matched:
    possible_percent = (int(forecast['possibleUnits'])/float(matched)) * 100.
    print('%s%% %s possible' % (possible_percent, forecast['unitType'].lower()))

if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client, LINE_ITEM_ID)
github googleads / googleads-python-lib / examples / ad_manager / v201908 / proposal_service / update_proposals.py View on Github external
# Display results.
    if proposals:
      for proposal in proposals:
        print('Proposal with id "%s", name "%s", and '
              'notes "%s" was updated.'
              % (proposal['id'], proposal['name'], proposal['internalNotes']))
    else:
      print('No proposals were updated.')
  else:
    print('No proposals found to update.')


if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client, PROPOSAL_ID)
github googleads / googleads-python-lib / examples / ad_manager / v201911 / publisher_query_language_service / get_recent_changes.py View on Github external
int(date_time_value['date']['day']),
                           int(date_time_value['hour']),
                           int(date_time_value['minute']),
                           int(date_time_value['second']))
  date_time_str = pytz.timezone(
      date_time_value['timeZoneId']).localize(date_time_obj).isoformat()

  if date_time_str[-5:] == '00:00':
    return date_time_str[:-6] + 'Z'
  else:
    return date_time_str


if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client)
github googleads / googleads-python-lib / examples / ad_manager / v201902 / report_service / run_reach_report.py View on Github external
report_file = tempfile.NamedTemporaryFile(suffix='.csv.gz', delete=False)

  # Download report data.
  report_downloader.DownloadReportToFile(
      report_job_id, export_format, report_file)

  report_file.close()

  # Display results.
  print('Report job with id "%s" downloaded to:\n%s' % (
      report_job_id, report_file.name))


if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client)