Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'strategy', 'v1.20', 'https://advertisersapitest.doubleclick.net')
# Construct and save placement strategy.
placement_strategy = {
'name': 'Strategy %s' % uuid.uuid4()
}
result = placement_strategy_service.savePlacementStrategy(
placement_strategy)
# Display results.
print 'Placement strategy with ID \'%s\' was created.' % result['id']
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client)
# Get placement types.
results = placement_service.getPlacementTypes()
# Display placement type names and IDs.
if results:
for placement_type in results:
print ('Placement type with name \'%s\' and ID \'%s\' was found.'
% (placement_type['name'], placement_type['id']))
else:
print 'No placement types found.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client)
# Get creative field values for the selected criteria.
results = creative_field_service.getCreativeFieldValues(
creative_field_value_search_criteria)
# Display creative field value names and IDs.
if results['records']:
for creative_field_value in results['records']:
print ('Creative field value with name \'%s\' and ID \'%s\' was found.'
% (creative_field_value['name'], creative_field_value['id']))
else:
print 'No creative field values found for your criteria.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client, CREATIVE_FIELD_ID)
def main(service_account_email, key_file, service_account_user,
user_profile_name, application_name):
oauth2_client = oauth2.GoogleServiceAccountClient(
oauth2.GetAPIScope('dfa'), service_account_email, key_file,
sub=service_account_user)
dfa_client = dfa.DfaClient(user_profile_name, oauth2_client, application_name)
campaign_service = dfa_client.GetService(
'campaign', server='https://advertisersapitest.doubleclick.net')
results = campaign_service.getCampaignsByCriteria({})
if results['records']:
for campaign in results['records']:
print ('Campaign with name \'%s\' and ID \'%s\' was found.'
% (campaign['name'], campaign['id']))
# Display creative name and its ID.
if results['records']:
for creative in results['records']:
print ('Creative with name \'%s\' and ID \'%s\' was found.'
% (creative['name'], creative['id']))
page_number += 1
creative_search_criteria['pageNumber'] = str(page_number)
if page_number > int(results['totalNumberOfPages']):
break
print 'Number of results found: %s' % results['totalNumberOfRecords']
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client, ADVERTISER_ID)
# Get content category record set.
results = content_category_service.getContentCategories(
content_category_search_criteria)
# Display content category names, IDs and descriptions.
if results['records']:
for content_category in results['records']:
print ('Content category with name \'%s\' and ID \'%s\' was found.'
% (content_category['name'], content_category['id']))
else:
print 'No content categories found for your criteria.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client)
# Get activity groups.
results = spotlight_service.getSpotlightActivityGroups(
spotlight_activity_group_search_criteria)
# Display activity group names and IDs.
if results['records']:
for activity_group in results['records']:
print ('Activity group with name \'%s\' and ID \'%s\' was found.'
% (activity_group['name'], activity_group['id']))
else:
print 'No activity groups found for your criteria.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client, ADVERTISER_ID)
# Get method types.
results = spotlight_service.getSpotlightTagMethodTypes()
# Display method type names and IDs.
if results:
for method_type in results:
print ('Method type with name \'%s\' and ID \'%s\' was found.'
% (method_type['name'], method_type['id']))
else:
print 'No method types found.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client)
'inStreamAsset': in_stream_video_asset,
'creativeId': in_stream_video_creative_id
}
# Replace the existing asset with a newly uploaded asset.
result = creative_service.replaceInStreamAsset(
asset_to_replace, in_stream_asset_upload_request)
# Display a success message.
print ('Replaced companion ad asset \'%s\' in In-Stream video creative with '
'ID \'%s\'.' % (asset_to_replace, result['id']))
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client, ASSET_NAME, PATH_TO_FILE, IN_STREAM_VIDEO_CREATIVE_ID,
ASSET_TO_REPLACE)
# Get available permissions.
results = user_role_service.getAvailablePermissions(subnetwork_id)
# Display permission name and its ID.
if results:
for permission in results:
print ('Permission with name \'%s\' and ID \'%s\' was found.'
% (permission['name'], permission['id']))
else:
print 'No permissions found.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client, SUBNETWORK_ID)