Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
'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)
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)
# 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)
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)
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)
# 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)
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)
}
]
}
# 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)
# 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)