Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Get placement types.
results = placement_service.getPlacementsByCriteria(
placement_search_criteria)
# Display placement names and IDs.
if results['records']:
for placement in results['records']:
print ('Placement with name \'%s\' and ID \'%s\' was found.'
% (placement['name'], placement['id']))
else:
print 'No placements found for your criteria.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client)
def main(client, advertiser_ids, advertiser_group_id):
# Initialize appropriate service.
advertiser_group_service = client.GetService(
'advertisergroup', 'v1.20', 'https://advertisersapitest.doubleclick.net')
# Assign the advertisers to the advertiser group.
advertiser_group_service.assignAdvertisersToAdvertiserGroup(
advertiser_group_id, advertiser_ids)
print 'Advertisers have been updated.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client, ADVERTISER_IDS, ADVERTISER_GROUP_IDS)
# Display creative group names, IDs, advertiser IDs, and group numbers.
if results['records']:
for creative_field_value in results['records']:
print ('Creative group with name \'%s\', ID \'%s\', advertiser ID \'%s\','
' and group number \'%s\' was found.'
% (creative_field_value['name'], creative_field_value['id'],
creative_field_value['advertiserId'],
creative_field_value['groupNumber']))
else:
print 'No creative groups found for your criteria.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client, ADVERTISER_ID)
# Construct and save creative field value.
creative_field_value = {
'name': creative_field_value_name,
'creativeFieldId': creative_field_id,
'id': '-1'
}
result = creative_field_service.saveCreativeFieldValue(
creative_field_value)
# Display results.
print 'Creative field value with ID \'%s\' was created.' % result['id']
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client, CREATIVE_FIELD_ID, CREATIVE_FIELD_VALUE_NAME)
if results['records']:
for change_log in results['records']:
print ('Action \'%s\', Context \'%s\', Change Date \'%s\','
' New Value \'%s\', Old Value \'%s\', Profile Name \'%s\''
' was found.'
% (change_log['action'],
change_log['context'], change_log['changeDate'],
change_log['newValue'], change_log['oldValue'],
change_log['username']))
else:
print 'No change log entries found for your criteria.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client, ADVERTISER_ID)
'creativeAssets': [{
'assetFilename': mobile_asset_file_name
}]
}
# If you don't specify an xsi_type for a creative, the client library will try
# to infer it from the typeId.
result = creative_service.saveCreative(mobile_creative, campaign_id)
# Display results.
print 'Mobile creative with ID \'%s\' was created.' % result['id']
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client, CAMPAIGN_ID, ADVERTISER_ID, CREATIVE_NAME,
MOBILE_ASSET_FILE_NAME)
def main(client_id, client_secret, refresh_token, user_profile_name,
application_name):
oauth2_client = oauth2.GoogleRefreshTokenClient(
client_id, client_secret, refresh_token)
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']))
results = subnetwork_service.getSubnetworks(
subnetwork_search_criteria)
# Display subnetwork names, IDs, and subnetwork IDs.
if results['records']:
for subnetwork in results['records']:
print ('Subnetwork with name \'%s\', ID \'%s\', part of network ID \'%s\''
' was found.' % (subnetwork['name'], subnetwork['id'],
subnetwork['networkId']))
else:
print 'No subnetworks found for your criteria.'
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client)
'advertisergroup', 'v1.20', 'https://advertisersapitest.doubleclick.net')
# Construct and save advertiser.
advertiser_group = {
'name': 'AdvertiserGroup %s' % uuid.uuid4()
}
result = advertiser_group_service.saveAdvertiserGroup(
advertiser_group)
# Display results.
print 'Advertiser group with ID \'%s\' was created.' % result['id']
if __name__ == '__main__':
# Initialize client object.
dfa_client = dfa.DfaClient.LoadFromStorage()
main(dfa_client)