Open Beyond-me opened 7 months ago
The complete error prompt is as follows:
Awaiting download_report...
Web service reported a SOAP processing fault using an unexpected HTTP status code 200. Reporting as an internal server error.
Traceback (most recent call last):
File "E:/LQ_JOB/advertising_channel/bing/BingAds-Python-SDK-main/examples/v13/report_requests.py", line 543, in
Process finished with exit code 1
I want to obtain the account performance report through the Python SDK, but it is not included in the example. Therefore, I followed the example and wrote this part of the code. The report in the example can run normally and download successfully, but the code I wrote cannot download the report properly. May I ask where I made a mistake? My code is as follows 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): 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): 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): global reporting_service_manager reporting_download_operation = reporting_service_manager.submit_download(report_request)
def download_results(request_id, authorization_data): reporting_download_operation = ReportingDownloadOperation( request_id = request_id, authorization_data=authorization_data, poll_interval_in_milliseconds=1000, environment=ENVIRONMENT, )
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
scope.Campaigns=None
if name == 'main':