How to use the googleads.adwords.AdWordsClient.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 / adwords / v201609 / reporting / download_criteria_report_with_awql.py View on Github external
'FROM CRITERIA_PERFORMANCE_REPORT '
                  'WHERE Status IN [ENABLED, PAUSED] '
                  'DURING LAST_7_DAYS')

  with open(path, 'w') as output_file:
    report_downloader.DownloadReportWithAwql(
        report_query, 'CSV', output_file, skip_report_header=False,
        skip_column_header=False, skip_report_summary=False,
        include_zero_impressions=True)

  print 'Report was downloaded to "%s".' % path


if __name__ == '__main__':
  # Initialize client object.
  adwords_client = adwords.AdWordsClient.LoadFromStorage()

  main(adwords_client, PATH)
github googleads / googleads-python-lib / examples / adwords / v201609 / basic_operations / update_keyword.py View on Github external
if 'value' in ad_group_criteria:
    for criterion in ad_group_criteria['value']:
      if criterion['criterion']['Criterion.Type'] == 'Keyword':
        print ('Ad group criterion with ad group id \'%s\' and criterion id '
               '\'%s\' currently has bids:'
               % (criterion['adGroupId'], criterion['criterion']['id']))
        for bid in criterion['biddingStrategyConfiguration']['bids']:
          print '\tType: \'%s\', value: %s' % (bid['Bids.Type'],
                                               bid['bid']['microAmount'])
  else:
    print 'No ad group criteria were updated.'


if __name__ == '__main__':
  # Initialize client object.
  adwords_client = adwords.AdWordsClient.LoadFromStorage()

  main(adwords_client, AD_GROUP_ID, CRITERION_ID)
github googleads / googleads-python-lib / examples / adwords / v201601 / campaign_management / validate_text_ad.py View on Github external
'displayUrl': 'example.com',
              'description1': 'Visit the Red Planet in style.',
              'description2': 'Low-gravity fun for all astronauts in orbit',
              'headline': 'Luxury Cruise to Mars'
          }
      }
  }]
  try:
    ad_group_ad_service.mutate(operations)
  except suds.WebFault, e:
    print 'Validation correctly failed with \'%s\'.' % str(e)


if __name__ == '__main__':
  # Initialize client object.
  adwords_client = adwords.AdWordsClient.LoadFromStorage()

  main(adwords_client, AD_GROUP_ID)
github googleads / googleads-python-lib / examples / adwords / v201601 / optimization / estimate_keyword_traffic.py View on Github external
if min_est and max_est:
    return (float(min_est) + float(max_est)) / 2.0
  else:
    return None


def _FormatMean(mean):
  if mean:
    return '%.2f' % mean
  else:
    return None


if __name__ == '__main__':
  # Initialize client object.
  adwords_client = adwords.AdWordsClient.LoadFromStorage()

  main(adwords_client)
github googleads / googleads-python-lib / examples / adwords / v201601 / account_management / get_account_changes.py View on Github external
if ad_group_data['adGroupChangeStatus'] != 'NEW':
                if 'changedAds' in ad_group_data:
                  print '    Changed ads: %s' % ad_group_data['changedAds']
                if 'changedCriteria' in ad_group_data:
                  print ('    Changed criteria: %s' %
                         ad_group_data['changedCriteria'])
                if 'removedCriteria' in ad_group_data:
                  print ('    Removed criteria: %s' %
                         ad_group_data['removedCriteria'])
  else:
    print 'No changes were found.'


if __name__ == '__main__':
  # Initialize client object.
  adwords_client = adwords.AdWordsClient.LoadFromStorage()
  main(adwords_client)
github googleads / googleads-python-lib / examples / adwords / v201802 / campaign_management / set_ad_parameters.py View on Github external
}
      }
  ]
  ad_params = ad_param_service.mutate(operations)

  # Display results.
  for ad_param in ad_params:
    print ('Ad parameter with text "%s" was successfully set for criterion '
           'with id "%s" and ad group id "%s".'
           % (ad_param['insertionText'], ad_param['criterionId'],
              ad_param['adGroupId']))


if __name__ == '__main__':
  # Initialize client object.
  adwords_client = adwords.AdWordsClient.LoadFromStorage()

  main(adwords_client, AD_GROUP_ID, CRITERION_ID)
github googleads / googleads-python-lib / examples / adxbuyer / v201402 / basic_operations / update_placement.py View on Github external
# Display results.
  if 'value' in ad_group_criteria:
    for criterion in ad_group_criteria['value']:
      if criterion['criterion']['Criterion.Type'] == 'Keyword':
        print ('Ad group criterion with ad group id \'%s\' and criterion id '
               '\'%s\' had its bid set to \'%s\'.'
               % (criterion['adGroupId'], criterion['criterion']['id'],
                  criterion['bids']['maxCpc']['amount']['microAmount']))
  else:
    print 'No ad group criteria were updated.'


if __name__ == '__main__':
  # Initialize client object.
  adwords_client = adwords.AdWordsClient.LoadFromStorage()

  main(adwords_client, AD_GROUP_ID, CRITERION_ID)
github googleads / googleads-python-lib / examples / adwords / v201809 / account_management / create_account.py View on Github external
}
  }]

  # Create the account. It is possible to create multiple accounts with one
  # request by sending an array of operations.
  accounts = managed_customer_service.mutate(operations)

  # Display results.
  for account in accounts['value']:
    print('Account with customer ID "%s" was successfully created.'
          % account['customerId'])


if __name__ == '__main__':
  # Initialize client object.
  adwords_client = adwords.AdWordsClient.LoadFromStorage()
  main(adwords_client)
github googleads / googleads-python-lib / examples / adwords / v201601 / basic_operations / add_campaigns.py View on Github external
'budgetId': budget_id
          },
          'advertisingChannelType': 'DISPLAY'
      }
  }]
  campaigns = campaign_service.mutate(operations)

  # Display results.
  for campaign in campaigns['value']:
    print ('Campaign with name \'%s\' and id \'%s\' was added.'
           % (campaign['name'], campaign['id']))


if __name__ == '__main__':
  # Initialize client object.
  adwords_client = adwords.AdWordsClient.LoadFromStorage()

  main(adwords_client)
github googleads / googleads-python-lib / examples / adwords / v201802 / extensions / add_site_links_using_feeds.py View on Github external
operations = [{
        'operator': 'ADD',
        'operand': feed_item_target
    }]

    response = feed_item_target_service.mutate(operations)

    if 'value' in response:
      print ('Feed item target for feed ID "%d" and feed item ID "%d" was '
             'created to restrict serving to ad group ID "%d".'
             % (feed_item_target['feedId'], feed_item_target['feedItemId'],
                feed_item_target['adGroupId']))

if __name__ == '__main__':
  # Initialize client object.
  adwords_client = adwords.AdWordsClient.LoadFromStorage()

  if AD_GROUP_ID == 'INSERT_AD_GROUP_ID_HERE':
    main(adwords_client, CAMPAIGN_ID)
  else:
    main(adwords_client, CAMPAIGN_ID, ad_group_id=AD_GROUP_ID)