bingads.v13.reporting package¶
Submodules¶
bingads.v13.reporting.exceptions module¶
- class bingads.v13.reporting.exceptions.OperationError(code=None, details=None, error_code=None, message=None)[source]¶
Bases:
object
Defines an error object that contains the details that explain why the service operation failed.
- property code¶
A numeric error code that identifies the error
- Return type
int
- property details¶
A message that provides additional details about the error. This string can be empty.
- Return type
str
- property error_code¶
A symbolic string constant that identifies the error. For example, UserIsNotAuthorized.
- Return type
str
- property message¶
A message that describes the error.
- Return type
str
- exception bingads.v13.reporting.exceptions.ReportingException(message, errors)[source]¶
Bases:
bingads.exceptions.SdkException
- property errors¶
The list of operation errors returned by the reporting service.
- Return type
list[OperationError]
bingads.v13.reporting.report_contract module¶
- exception bingads.v13.reporting.report_contract.InvalidReportColumnException(column_name)[source]¶
Bases:
bingads.exceptions.SdkException
This exception is thrown if trying to retrieve inexistent column
- class bingads.v13.reporting.report_contract.Report[source]¶
Bases:
object
- property last_completed_available_date¶
- property potential_incomplete_data¶
- property record_count¶
- property report_aggregation¶
- property report_columns¶
- property report_name¶
- property report_records¶
- property report_time_end¶
- property report_time_start¶
- property time_zone¶
bingads.v13.reporting.report_file_reader module¶
bingads.v13.reporting.reporting_download_parameters module¶
- class bingads.v13.reporting.reporting_download_parameters.ReportingDownloadParameters(report_request=None, result_file_directory=None, result_file_name=None, overwrite_result_file=False, timeout_in_milliseconds=None)[source]¶
Bases:
object
Describes the related parameters when downloading file from server.
such as the file name and directory that you want to specify.
- property decompress_result_file¶
If need to decompress the result file after download. This property is determined by the result_file_name, by default will do decompression. if the result_file_name has the extension of ‘.zip’ then do not do decompression. :rtype: bool
- property overwrite_result_file¶
Whether the local result file should be overwritten if it already exists. :rtype: bool
- property report_request¶
The report request. :rtype: ReportRequest
- property result_file_directory¶
The directory where the reporting file will be downloaded. :rtype: str
- property result_file_name¶
The name of the download reporting file. :rtype: str
- property timeout_in_milliseconds¶
bingads.v13.reporting.reporting_operation module¶
- class bingads.v13.reporting.reporting_operation.ReportingDownloadOperation(request_id, authorization_data, poll_interval_in_milliseconds=5000, environment='production', tracking_id=None, **suds_options)[source]¶
Bases:
object
Represents a reporting download operation requested by a user.
You can use this class to poll for the download status, and then download the file when available.
Example:
The
ReportingServiceManager.submit_download()
method returns an instance of this class. If for any reason you do not want to wait for the file to be prepared for download, for example if your application quits unexpectedly or you have other tasks to process, you can use an instance ofReportingDownloadOperation
to download the file when it is available.- download_result_file(result_file_directory, result_file_name, decompress, overwrite, timeout_in_milliseconds=None)[source]¶
Download file with specified URL and download parameters.
- Parameters
result_file_directory (str) – The download result local directory name.
result_file_name (str | None) – The download result local file name.
decompress (bool) – Determines whether to decompress the ZIP file. If set to true, the file will be decompressed after download. The default value is false, in which case the downloaded file is not decompressed.
overwrite (bool) – Indicates whether the result file should overwrite the existing file if any.
timeout_in_milliseconds (int) – (optional) timeout for download result file in milliseconds
- Returns
The download file path.
- Return type
str
- property final_status¶
Gets the final status of the reporting operation or null if the operation is still running.
- Return type
- get_status()[source]¶
Track the detailed download status.
- Returns
The status of reporting download operation.
- Return type
- property poll_interval_in_milliseconds¶
The time interval in milliseconds between two status polling attempts.
- Return type
int
- property request_id¶
The request identifier corresponding to the reporting download, depending on the derived type.
- Return type
str
- property service_client¶
The internal reporting service client.
- Return type
- class bingads.v13.reporting.reporting_operation.TlsHttpAdapter(pool_connections=10, pool_maxsize=10, max_retries=0, pool_block=False)[source]¶
Bases:
requests.adapters.HTTPAdapter
” Transport adapter that chooses the TLS protocols based on python versions.
- init_poolmanager(connections, maxsize, block=False)[source]¶
Initializes a urllib3 PoolManager.
This method should not be called from user code, and is only exposed for use when subclassing the
HTTPAdapter
.- Parameters
connections – The number of urllib3 connection pools to cache.
maxsize – The maximum number of connections to save in the pool.
block – Block when no free connections are available.
pool_kwargs – Extra keyword arguments used to initialize the Pool Manager.
bingads.v13.reporting.reporting_operation_status module¶
- class bingads.v13.reporting.reporting_operation_status.ReportingOperationStatus(status=None, report_download_url=None)[source]¶
Bases:
object
Contains tracking details about the Report Request Status
- property report_download_url¶
The report download Url. :rtype: str
- property status¶
The download status. :rtype: str
bingads.v13.reporting.reporting_service_manager module¶
- class bingads.v13.reporting.reporting_service_manager.ReportingServiceManager(authorization_data, poll_interval_in_milliseconds=5000, environment='production', working_directory=None, **suds_options)[source]¶
Bases:
object
Provides high level methods for downloading reporting files using the Reporting API functionality.
Also provides methods for submitting download operations.
Example:
download_file()
will submit the download request to the reporting service, poll until the status is completed (or returns an error), and downloads the file locally. If instead you want to manage the low level details you would first callsubmit_download()
, wait for the results file to be prepared using eitherReportingDownloadOperation.get_status()
orReportingDownloadOperation.track()
, and then download the file with theReportingOperation.download_result_file()
method.- download_file(download_parameters)[source]¶
Downloads the specified reporting to a local file.
- Parameters
download_parameters (ReportingDownloadParameters) – Determines various download parameters, for example where the file should be downloaded.
- Returns
The downloaded local reporting file path.
- Return type
str
- download_report(download_parameters)[source]¶
Downloads the specified reporting to a local file and parse it with report_file_reader.
- Parameters
download_parameters (ReportingDownloadParameters) – Determines various download parameters, for example where the file should be downloaded.
- Returns
Report object parsed from the downloaded local reporting file path.
- Return type
- property poll_interval_in_milliseconds¶
The time interval in milliseconds between two status polling attempts.
- Return type
int
- property service_client¶
The internal reporting service client.
- Return type
- submit_download(report_request)[source]¶
Submits a download request to the Bing Ads reporting service with the specified request.
- Parameters
report_request (ReportRequest) – Determines what kind of reporting file to download
- Returns
The submitted download operation
- Return type
- property suds_options¶
suds option parameters
- Returns
dict
- property working_directory¶
Directory for storing temporary files needed for some operations (for example
upload_entities()
creates a temporary upload file).- Return type
str