How to use the googleads.dfp.DfpClient.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 / dfp / v201805 / proposal_service / get_marketplace_comments.py View on Github external
for marketplace_comment in response['results']:
    date_time = marketplace_comment['creationTime']
    date_time_string = datetime(date_time['date']['year'],
                                date_time['date']['month'],
                                date_time['date']['day'], date_time['hour'],
                                date_time['minute'],
                                date_time['second']).isoformat()
    print('Marketplace comment with creation time "%s"and comment "%s" was '
          'found.\n' % (date_time_string, marketplace_comment['comment']))

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


if __name__ == '__main__':
  # Initialize client object.
  dfp_client = dfp.DfpClient.LoadFromStorage()
  main(dfp_client, PROPOSAL_ID)
github googleads / googleads-python-lib / examples / dfp / v201511 / order_service / create_orders.py View on Github external
'salespersonId': salesperson_id,
        'traffickerId': trafficker_id
    }
    orders.append(order)

  # Add orders.
  orders = order_service.createOrders(orders)

  # Display results.
  for order in orders:
    print ('Order with id \'%s\' and name \'%s\' was created.'
           % (order['id'], order['name']))

if __name__ == '__main__':
  # Initialize client object.
  dfp_client = dfp.DfpClient.LoadFromStorage()
  main(dfp_client, COMPANY_ID, SALESPERSON_ID, TRAFFICKER_ID)
github googleads / googleads-python-lib / examples / dfp / v201802 / report_service / run_report_with_custom_fields.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.
  dfp_client = dfp.DfpClient.LoadFromStorage()
  main(dfp_client, ORDER_ID)
github googleads / googleads-python-lib / examples / dfp / v201705 / line_item_service / update_line_items.py View on Github external
# Display results.
    if line_items:
      for line_item in line_items:
        print ('Line item with id "%s", belonging to order id "%s", named '
               '"%s", and delivery rate "%s" was updated.'
               % (line_item['id'], line_item['orderId'], line_item['name'],
                  line_item['deliveryRateType']))
    else:
      print 'No line items were updated.'
  else:
    print 'No line items found to update.'

if __name__ == '__main__':
  # Initialize client object.
  dfp_client = dfp.DfpClient.LoadFromStorage()
  main(dfp_client, ORDER_ID)
github googleads / googleads-python-lib / examples / dfp / v201511 / proposal_line_item_service / get_all_proposal_line_items.py View on Github external
for idx, proposal_line_item in enumerate(response['results'],
                                               start=statement.offset):
        print ('%s) Proposal line item with id \'%s\', belonging to proposal id'
               ' \'%s\', and named \'%s\' was found.' %
               (idx, proposal_line_item['id'], proposal_line_item['proposalId'],
                proposal_line_item['name']))
      statement.offset += dfp.SUGGESTED_PAGE_LIMIT
    else:
      break

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


if __name__ == '__main__':
  # Initialize client object.
  dfp_client = dfp.DfpClient.LoadFromStorage()
  main(dfp_client)
github googleads / googleads-python-lib / examples / dfp / v201705 / product_package_item_service / get_all_product_package_items.py View on Github external
for product_package_item in response['results']:
        # Print out some information for each product package item.
        print('Product package item with ID "%d", product id "%d", and product '
              'package id "%d" was found.\n' %
              (product_package_item['id'], product_package_item['productId'],
               product_package_item['productPackageId']))
      statement.offset += statement.limit
    else:
      break

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


if __name__ == '__main__':
  # Initialize client object.
  dfp_client = dfp.DfpClient.LoadFromStorage()
  main(dfp_client)
github googleads / googleads-python-lib / examples / dfp / v201602 / order_service / get_orders_by_statement.py View on Github external
# Get orders by statement.
  response = order_service.getOrdersByStatement(statement.ToStatement())
  orders = []
  if 'results' in response:
    orders = response['results']

  # Display results.
  for order in orders:
    print ('Order with id \'%s\' name \'%s\' was found.'
           % (order['id'], order['name']))

  print '\nNumber of results found: %s' % len(orders)

if __name__ == '__main__':
  # Initialize client object.
  dfp_client = dfp.DfpClient.LoadFromStorage()
  main(dfp_client, ORDER_ID)
github googleads / googleads-python-lib / examples / dfp / v201511 / exchange_rate_service / update_exchange_rates.py View on Github external
print ('Exchange rate with id \'%s,\' currency code \'%s,\' '
               'direction \'%s,\' and exchange rate \'%.2f\' '
               'was updated.' % (exchange_rate['id'],
                                 exchange_rate['currencyCode'],
                                 exchange_rate['direction'],
                                 (float(exchange_rate['exchangeRate']) /
                                  10000000000)))
    else:
      print 'No exchange rates were updated.'
  else:
    print 'No exchange rates found to update.'


if __name__ == '__main__':
  # Initialize client object.
  dfp_client = dfp.DfpClient.LoadFromStorage()
  main(dfp_client, EXCHANGE_RATE_ID)
github googleads / googleads-python-lib / examples / dfp / v201511 / creative_service / create_creative_from_template.py View on Github external
}
      ]
  }

  # Call service to create the creative.
  creative = creative_service.createCreatives([creative])[0]

  # Display results.
  print ('Template creative with id \'%s\', name \'%s\', and type \'%s\' was '
         'created and can be previewed at %s.'
         % (creative['id'], creative['name'], dfp.DfpClassType(creative),
            creative['previewUrl']))

if __name__ == '__main__':
  # Initialize client object.
  dfp_client = dfp.DfpClient.LoadFromStorage()
  main(dfp_client, ADVERTISER_ID)
github googleads / googleads-python-lib / examples / dfp / v201711 / report_service / run_saved_query.py View on Github external
# 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)
    else:
      print 'The query specified is not compatible with the API version.'


if __name__ == '__main__':
  # Initialize client object.
  dfp_client = dfp.DfpClient.LoadFromStorage()
  main(dfp_client, SAVED_QUERY_ID)