diff --git a/python/v4/create_report.py b/python/v4/create_report.py index e51aaa1..41c0b75 100644 --- a/python/v4/create_report.py +++ b/python/v4/create_report.py @@ -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 @@ -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): diff --git a/python/v4/delete_report.py b/python/v4/delete_report.py index 4f615b8..3cb482a 100644 --- a/python/v4/delete_report.py +++ b/python/v4/delete_report.py @@ -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 ' diff --git a/python/v4/download_placement_tags.py b/python/v4/download_placement_tags.py index 57ca8cb..dc5cc1e 100644 --- a/python/v4/download_placement_tags.py +++ b/python/v4/download_placement_tags.py @@ -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__': diff --git a/python/v4/find_and_download_file.py b/python/v4/find_and_download_file.py index 552e4d5..bece86f 100644 --- a/python/v4/find_and_download_file.py +++ b/python/v4/find_and_download_file.py @@ -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 ' @@ -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 @@ -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): diff --git a/python/v4/find_and_run_report.py b/python/v4/find_and_run_report.py index 208bfd6..6c66b17 100644 --- a/python/v4/find_and_run_report.py +++ b/python/v4/find_and_run_report.py @@ -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 ' @@ -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 @@ -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 @@ -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) diff --git a/python/v4/get_ads.py b/python/v4/get_ads.py index a7d38ee..1359adf 100755 --- a/python/v4/get_ads.py +++ b/python/v4/get_ads.py @@ -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) diff --git a/python/v4/get_compatible_fields.py b/python/v4/get_compatible_fields.py index 22fcf00..55cb91f 100644 --- a/python/v4/get_compatible_fields.py +++ b/python/v4/get_compatible_fields.py @@ -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__': diff --git a/python/v4/get_size.py b/python/v4/get_size.py index a09f47a..b2141c5 100644 --- a/python/v4/get_size.py +++ b/python/v4/get_size.py @@ -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 ' diff --git a/python/v4/insert_offline_mobile_conversion.py b/python/v4/insert_offline_mobile_conversion.py index d659e0d..8169a81 100644 --- a/python/v4/insert_offline_mobile_conversion.py +++ b/python/v4/insert_offline_mobile_conversion.py @@ -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 ' diff --git a/python/v4/insert_offline_user_conversion.py b/python/v4/insert_offline_user_conversion.py index 974c3f1..635b9cf 100644 --- a/python/v4/insert_offline_user_conversion.py +++ b/python/v4/insert_offline_user_conversion.py @@ -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 ' diff --git a/python/v4/run_report.py b/python/v4/run_report.py index cc83059..de8dc61 100644 --- a/python/v4/run_report.py +++ b/python/v4/run_report.py @@ -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. @@ -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: diff --git a/python/v4/target_ad_to_remarketing_list.py b/python/v4/target_ad_to_remarketing_list.py index 658e252..915fad7 100644 --- a/python/v4/target_ad_to_remarketing_list.py +++ b/python/v4/target_ad_to_remarketing_list.py @@ -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') diff --git a/python/v4/update_offline_mobile_conversion.py b/python/v4/update_offline_mobile_conversion.py index 9fd2736..8c8067f 100644 --- a/python/v4/update_offline_mobile_conversion.py +++ b/python/v4/update_offline_mobile_conversion.py @@ -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 ' diff --git a/python/v4/update_offline_user_conversion.py b/python/v4/update_offline_user_conversion.py index e7b9fff..10b8f00 100644 --- a/python/v4/update_offline_user_conversion.py +++ b/python/v4/update_offline_user_conversion.py @@ -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 '