You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run the code to obtain the account performance report, it prompts There is no report data for the submitted report request parameters
Where did I go wrong? What should I do?
from auth_helper import *
from bingads import AuthorizationData
from bingads.v13.reporting import *
from output_helper import output_bing_ads_webfault_error, output_webfault_errors, output_status_message
from auth_helper import authenticate
def main(authorization_data):
# try:
# You can submit one of the example reports, or build your own.
report_request=get_report_request(authorization_data.account_id)
reporting_download_parameters = ReportingDownloadParameters(
report_request=report_request,
result_file_directory = FILE_DIRECTORY,
result_file_name = RESULT_FILE_NAME,
overwrite_result_file = True, # Set this value true if you want to overwrite the same file.
timeout_in_milliseconds=TIMEOUT_IN_MILLISECONDS # You may optionally cancel the download after a specified time interval.
)
output_status_message("-----\nAwaiting download_report...")
download_report(reporting_download_parameters)
def background_completion(reporting_download_parameters):
""" You can submit a download request and the ReportingServiceManager will automatically
return results. The ReportingServiceManager abstracts the details of checking for result file
completion, and you don't have to write any code for results polling. """
global reporting_service_manager
result_file_path = reporting_service_manager.download_file(reporting_download_parameters)
output_status_message("Download result file: {0}".format(result_file_path))
def submit_and_download(report_request):
""" Submit the download request and then use the ReportingDownloadOperation result to
track status until the report is complete e.g. either using
ReportingDownloadOperation.track() or ReportingDownloadOperation.get_status(). """
global reporting_service_manager
reporting_download_operation = reporting_service_manager.submit_download(report_request)
# You may optionally cancel the track() operation after a specified time interval.
reporting_operation_status = reporting_download_operation.track(timeout_in_milliseconds=TIMEOUT_IN_MILLISECONDS)
result_file_path = reporting_download_operation.download_result_file(
result_file_directory = FILE_DIRECTORY,
result_file_name = RESULT_FILE_NAME,
decompress = True,
overwrite = True, # Set this value true if you want to overwrite the same file.
timeout_in_milliseconds=TIMEOUT_IN_MILLISECONDS # You may optionally cancel the download after a specified time interval.
)
output_status_message("Download result file: {0}".format(result_file_path))
reporting_download_operation = ReportingDownloadOperation(
request_id = request_id,
authorization_data=authorization_data,
poll_interval_in_milliseconds=1000,
environment=ENVIRONMENT,
)
reporting_operation_status = reporting_download_operation.track(timeout_in_milliseconds=TIMEOUT_IN_MILLISECONDS)
result_file_path = reporting_download_operation.download_result_file(
result_file_directory = FILE_DIRECTORY,
result_file_name = RESULT_FILE_NAME,
decompress = True,
overwrite = True, # Set this value true if you want to overwrite the same file.
timeout_in_milliseconds=TIMEOUT_IN_MILLISECONDS # You may optionally cancel the download after a specified time interval.
)
output_status_message("Download result file: {0}".format(result_file_path))
output_status_message("Status: {0}".format(reporting_operation_status.status))
def download_report(reporting_download_parameters):
global reporting_service_manager
report_container = reporting_service_manager.download_report(reporting_download_parameters)
if(report_container == None):
output_status_message("There is no report data for the submitted report request parameters.")
sys.exit(0)
report_container.close()
def get_report_request(account_id):
"""
Use a sample report request or build your own.
"""
aggregation = 'Summary'
exclude_column_headers=False
exclude_report_footer=False
exclude_report_header=False
time=reporting_service.factory.create('ReportTime')
# You can either use a custom date range or predefined time.
time.PredefinedTime='LastMonth'
time.ReportTimeZone='PacificTimeUSCanadaTijuana'
time.CustomDateRangeStart = None
time.CustomDateRangeEnd = None
return_only_complete_data=True
account_performance_report_request = get_account_performance_report_request(
account_id=account_id,
aggregation=aggregation,
exclude_column_headers=exclude_column_headers,
exclude_report_footer=exclude_report_footer,
exclude_report_header=exclude_report_header,
report_file_format=REPORT_FILE_FORMAT,
return_only_complete_data=return_only_complete_data,
time=time)
return account_performance_report_request
When I run the code to obtain the account performance report, it prompts There is no report data for the submitted report request parameters
Where did I go wrong? What should I do?
from auth_helper import *
from bingads import AuthorizationData
from bingads.v13.reporting import *
from output_helper import output_bing_ads_webfault_error, output_webfault_errors, output_status_message
from auth_helper import authenticate
REPORT_FILE_FORMAT='Csv'
FILE_DIRECTORY='reports'
RESULT_FILE_NAME='result.' + REPORT_FILE_FORMAT.lower()
TIMEOUT_IN_MILLISECONDS=3600000
def main(authorization_data):
# try:
# You can submit one of the example reports, or build your own.
def background_completion(reporting_download_parameters):
""" You can submit a download request and the ReportingServiceManager will automatically
return results. The ReportingServiceManager abstracts the details of checking for result file
completion, and you don't have to write any code for results polling. """
def submit_and_download(report_request):
""" Submit the download request and then use the ReportingDownloadOperation result to
track status until the report is complete e.g. either using
ReportingDownloadOperation.track() or ReportingDownloadOperation.get_status(). """
def download_results(request_id, authorization_data):
def download_report(reporting_download_parameters):
global reporting_service_manager
def get_report_request(account_id):
"""
Use a sample report request or build your own.
"""
def get_account_performance_report_request(
account_id,
aggregation,
exclude_column_headers,
exclude_report_footer,
exclude_report_header,
report_file_format,
return_only_complete_data,
time):
report_request=reporting_service.factory.create('AccountPerformanceReportRequest')
report_request.Aggregation=aggregation
report_request.ExcludeColumnHeaders=exclude_column_headers
report_request.ExcludeReportFooter=exclude_report_footer
report_request.ExcludeReportHeader=exclude_report_header
report_request.Format=report_file_format
report_request.ReturnOnlyCompleteData=return_only_complete_data
report_request.Time=time
report_request.ReportName = "My Account Performance Report"
scope = reporting_service.factory.create('AccountReportScope')
scope.AccountIds={'long': [account_id] }
report_request.Scope=scope
report_columns=reporting_service.factory.create('ArrayOfAccountPerformanceReportColumn')
report_columns.AccountPerformanceReportColumn.append([
'AccountName',
'CurrencyCode',
'Ctr',
'AverageCpc',
'Conversions',
'Impressions',
'Clicks',
'Spend'
])
report_request.Columns=report_columns
if name == 'main':
The text was updated successfully, but these errors were encountered: