Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/v4/create_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def create_report_resource():
'format': 'CSV'
}

print 'Creating %s report resource with name "%s".' % (report['type'],
report['name'])
print ('Creating %s report resource with name "%s".' % (report['type'],
report['name']))

return report

Expand All @@ -99,7 +99,7 @@ def define_report_criteria(report):
# Add the criteria to the report resource.
report['criteria'] = criteria

print '\nAdded report criteria:\n%s' % criteria
print ('\nAdded report criteria:\n%s' % criteria)


def find_compatible_fields(service, profile_id, report):
Expand Down
2 changes: 1 addition & 1 deletion python/v4/delete_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def main(argv):
# Execute request and print response.
request.execute()

print 'Successfully deleted report with ID %s.' % report_id
print ('Successfully deleted report with ID %s.' % report_id)

except client.AccessTokenRefreshError:
print ('The credentials have been revoked or expired, please re-run the '
Expand Down
4 changes: 2 additions & 2 deletions python/v4/download_placement_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ def print_placement_tag(placement_tag):
% (placement_tag['placementId'], tag_data['format']))

if 'impressionTag' in tag_data:
print '%s\n\n' % (tag_data['impressionTag'])
print ('%s\n\n' % (tag_data['impressionTag']))
if 'clickTag' in tag_data:
print '%s\n\n' % (tag_data['clickTag'])
print ('%s\n\n' % (tag_data['clickTag']))


if __name__ == '__main__':
Expand Down
13 changes: 6 additions & 7 deletions python/v4/find_and_download_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def main(argv):
# 3. Directly download the file.
direct_download_file(service, report_id, report_file['id'])
else:
print 'No file found for profile ID %d and report ID %d.' % (profile_id,
report_id)
print ('No file found for profile ID %d and report ID %d.' % (profile_id,
report_id))

except client.AccessTokenRefreshError:
print('The credentials have been revoked or expired, please re-run the '
Expand Down Expand Up @@ -86,12 +86,11 @@ def find_file(service, profile_id, report_id):
break

if target:
print 'Found file %s with filename "%s".' % (target['id'],
target['fileName'])
print ('Found file %s with filename "%s".' % (target['id'],
target['fileName']))
return target

print 'Unable to find file for profile ID %d and report ID %d.' % (profile_id,
report_id)
print ('Unable to find file for profile ID %d and report ID %d.' % (profile_id,report_id))
return None


Expand All @@ -107,7 +106,7 @@ def generate_browser_url(service, report_id, file_id):
reportId=report_id, fileId=file_id).execute()
browser_url = report_file['urls']['browserUrl']

print 'File %s has browser URL: %s.' % (report_file['id'], browser_url)
print ('File %s has browser URL: %s.' % (report_file['id'], browser_url))


def direct_download_file(service, report_id, file_id):
Expand Down
18 changes: 9 additions & 9 deletions python/v4/find_and_run_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def main(argv):
# 3. Wait for the report file to be ready.
wait_for_report_file(service, report['id'], report_file['id'])
else:
print 'No report found for profile ID %d.\n' % profile_id
print ('No report found for profile ID %d.\n' % profile_id)

except client.AccessTokenRefreshError:
print('The credentials have been revoked or expired, please re-run the '
Expand Down Expand Up @@ -86,10 +86,10 @@ def find_report(service, profile_id):
break

if target:
print 'Found report %s with name "%s".' % (target['id'], target['name'])
print ('Found report %s with name "%s".' % (target['id'], target['name']))
return target

print 'Unable to find report for profile ID %d.' % profile_id
print ('Unable to find report for profile ID %d.' % profile_id)
return None


Expand All @@ -105,8 +105,8 @@ def run_report(service, profile_id, report_id):
report_file = service.reports().run(
profileId=profile_id, reportId=report_id).execute()

print 'Running report %s, current file status is %s.' % (
report_id, report_file['status'])
print ('Running report %s, current file status is %s.' % (
report_id, report_file['status']))
return report_file


Expand All @@ -122,17 +122,17 @@ def wait_for_report_file(service, report_id, file_id):

status = report_file['status']
if status == 'REPORT_AVAILABLE':
print 'File status is %s, ready to download.' % status
print ('File status is %s, ready to download.' % status)
return
elif status != 'PROCESSING':
print 'File status is %s, processing failed.' % status
print ('File status is %s, processing failed.' % status)
return
elif time.time() - start_time > MAX_RETRY_ELAPSED_TIME:
print 'File processing deadline exceeded.'
print ('File processing deadline exceeded.')
return

sleep = next_sleep_interval(sleep)
print 'File status is %s, sleeping for %d seconds.' % (status, sleep)
print ('File status is %s, sleeping for %d seconds.' % (status, sleep))
time.sleep(sleep)


Expand Down
2 changes: 1 addition & 1 deletion python/v4/get_ads.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def main(argv):
response = request.execute()

for ad in response['ads']:
print 'Found ad with ID %s and name "%s".' % (ad['id'], ad['name'])
print ('Found ad with ID %s and name "%s".' % (ad['id'], ad['name']))

if response['ads'] and response['nextPageToken']:
request = service.ads().list_next(request, response)
Expand Down
2 changes: 1 addition & 1 deletion python/v4/get_compatible_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_compatible_fields_type(report_type):

def print_fields(field_type, fields):
field_names = [field['name'] for field in fields]
print 'Compatible %s\n%s\n\n' % (field_type, ','.join(field_names))
print ('Compatible %s\n%s\n\n' % (field_type, ','.join(field_names)))


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion python/v4/get_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def main(argv):
result = request.execute()

for size in result['sizes']:
print 'Found size with ID %s.' % (size['id'])
print ('Found size with ID %s.' % (size['id']))

except client.AccessTokenRefreshError:
print ('The credentials have been revoked or expired, please re-run the '
Expand Down
2 changes: 1 addition & 1 deletion python/v4/insert_offline_mobile_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def main(argv):

status = response['status'][0]
for error in status['errors']:
print '\t[%s]: %s' % (error['code'], error['message'])
print ('\t[%s]: %s' % (error['code'], error['message']))

except client.AccessTokenRefreshError:
print ('The credentials have been revoked or expired, please re-run the '
Expand Down
2 changes: 1 addition & 1 deletion python/v4/insert_offline_user_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def main(argv):

status = response['status'][0]
for error in status['errors']:
print '\t[%s]: %s' % (error['code'], error['message'])
print ('\t[%s]: %s' % (error['code'], error['message']))

except client.AccessTokenRefreshError:
print ('The credentials have been revoked or expired, please re-run the '
Expand Down
10 changes: 5 additions & 5 deletions python/v4/run_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def main(argv):
# Run the report.
report_file = service.reports().run(profileId=profile_id,
reportId=report_id).execute()
print 'File with ID %s has been created.' % report_file['id']
print ('File with ID %s has been created.' % report_file['id'])

# Wait for the report file to finish processing.
# An exponential backoff strategy is used to conserve request quota.
Expand All @@ -68,17 +68,17 @@ def main(argv):

status = report_file['status']
if status == 'REPORT_AVAILABLE':
print 'File status is %s, ready to download.' % status
print ('File status is %s, ready to download.' % status)
return
elif status != 'PROCESSING':
print 'File status is %s, processing failed.' % status
print ('File status is %s, processing failed.' % status)
return
elif time.time() - start_time > MAX_RETRY_ELAPSED_TIME:
print 'File processing deadline exceeded.'
print ('File processing deadline exceeded.')
return

sleep = next_sleep_interval(sleep)
print 'File status is %s, sleeping for %d seconds.' % (status, sleep)
print ('File status is %s, sleeping for %d seconds.' % (status, sleep))
time.sleep(sleep)

except client.AccessTokenRefreshError:
Expand Down
2 changes: 1 addition & 1 deletion python/v4/target_ad_to_remarketing_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def main(argv):
% (response['id'],
response['remarketingListExpression']['expression']))
else:
print 'No targetable remarketing lists found for ad with ID %d.' % ad_id
print ('No targetable remarketing lists found for ad with ID %d.' % ad_id)
except client.AccessTokenRefreshError:
print('The credentials have been revoked or expired, please re-run the '
'application to re-authorize')
Expand Down
2 changes: 1 addition & 1 deletion python/v4/update_offline_mobile_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def main(argv):

status = response['status'][0]
for error in status['errors']:
print '\t[%s]: %s' % (error['code'], error['message'])
print ('\t[%s]: %s' % (error['code'], error['message']))

except client.AccessTokenRefreshError:
print('The credentials have been revoked or expired, please re-run the '
Expand Down
2 changes: 1 addition & 1 deletion python/v4/update_offline_user_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def main(argv):

status = response['status'][0]
for error in status['errors']:
print '\t[%s]: %s' % (error['code'], error['message'])
print ('\t[%s]: %s' % (error['code'], error['message']))

except client.AccessTokenRefreshError:
print('The credentials have been revoked or expired, please re-run the '
Expand Down