Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:return: The download local bulk file path.
:rtype: str
"""
start_timestamp = _TimeHelper.get_current_time_milliseconds()
file_upload_parameters._submit_upload_parameters.timeout_in_milliseconds = file_upload_parameters.timeout_in_milliseconds
operation = self.submit_upload(file_upload_parameters._submit_upload_parameters)
upload_operation_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, file_upload_parameters.timeout_in_milliseconds)
try:
operation.track(progress, upload_operation_timeout)
except TimeoutException:
raise BulkUploadException("Bulk file upload tracking status timeout.")
result_file_directory = self.working_directory
if file_upload_parameters.result_file_directory is not None:
result_file_directory = file_upload_parameters.result_file_directory
download_result_file_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, file_upload_parameters.timeout_in_milliseconds)
result_file_path = operation.download_result_file(
result_file_directory=result_file_directory,
result_file_name=file_upload_parameters.result_file_name,
decompress=file_upload_parameters.decompress_result_file,
overwrite=file_upload_parameters.overwrite_result_file,
timeout_in_milliseconds=download_result_file_timeout,
)
return result_file_path
:param download_parameters: Determines various download parameters, for example where the file should be downloaded.
:type download_parameters: ReportingDownloadParameters
:return: The downloaded local reporting file path.
:rtype: str
"""
start_timestamp = _TimeHelper.get_current_time_milliseconds()
operation = self.submit_download(download_parameters.report_request)
try:
operation.track(download_parameters.timeout_in_milliseconds)
except TimeoutException:
raise ReportingDownloadException("Reporting file download tracking status timeout.")
result_file_directory = self.working_directory
if download_parameters.result_file_directory is not None:
result_file_directory = download_parameters.result_file_directory
download_result_file_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, download_parameters.timeout_in_milliseconds)
result_file_path = operation.download_result_file(
result_file_directory=result_file_directory,
result_file_name=download_parameters.result_file_name,
decompress=download_parameters.decompress_result_file,
overwrite=download_parameters.overwrite_result_file,
timeout_in_milliseconds=download_result_file_timeout,
)
return result_file_path
def download_upload_result(self, operation, file_upload_parameters, progress=None):
start_timestamp = _TimeHelper.get_current_time_milliseconds()
upload_operation_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, file_upload_parameters.timeout_in_milliseconds)
try:
operation.track(progress, upload_operation_timeout)
except TimeoutException:
raise BulkUploadException("Bulk file upload tracking status timeout.")
result_file_directory = self.working_directory
if file_upload_parameters.result_file_directory is not None:
result_file_directory = file_upload_parameters.result_file_directory
download_result_file_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, file_upload_parameters.timeout_in_milliseconds)
result_file_path = operation.download_result_file(
result_file_directory=result_file_directory,
result_file_name=file_upload_parameters.result_file_name,
decompress=file_upload_parameters.decompress_result_file,
overwrite=file_upload_parameters.overwrite_result_file,
timeout_in_milliseconds=download_result_file_timeout,
)
return result_file_path
:param progress: (optional) Tracking the percent complete progress information for the bulk operation.
:type progress: BulkOperationProgressInfo -> None
:return: The downloaded local bulk file path.
:rtype: str
"""
start_timestamp = _TimeHelper.get_current_time_milliseconds()
operation = self.submit_download(download_parameters._submit_download_parameter)
try:
operation.track(progress, download_parameters.timeout_in_milliseconds)
except TimeoutException:
raise BulkDownloadException("Bulk file download tracking status timeout.")
result_file_directory = self.working_directory
if download_parameters.result_file_directory is not None:
result_file_directory = download_parameters.result_file_directory
download_result_file_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, download_parameters.timeout_in_milliseconds)
result_file_path = operation.download_result_file(
result_file_directory=result_file_directory,
result_file_name=download_parameters.result_file_name,
decompress=download_parameters.decompress_result_file,
overwrite=download_parameters.overwrite_result_file,
timeout_in_milliseconds=download_result_file_timeout,
)
return result_file_path
def upload_file(self, file_upload_parameters, progress=None):
""" Uploads the specified Bulk file.
:param file_upload_parameters: Determines various upload parameters.
:type file_upload_parameters: FileUploadParameters
:param progress: (optional) Tracking the percent complete progress information for the bulk operation.
:type progress: BulkOperationProgressInfo -> None
:return: The download local bulk file path.
:rtype: str
"""
start_timestamp = _TimeHelper.get_current_time_milliseconds()
file_upload_parameters._submit_upload_parameters.timeout_in_milliseconds = file_upload_parameters.timeout_in_milliseconds
operation = self.submit_upload(file_upload_parameters._submit_upload_parameters)
upload_operation_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, file_upload_parameters.timeout_in_milliseconds)
try:
operation.track(progress, upload_operation_timeout)
except TimeoutException:
raise BulkUploadException("Bulk file upload tracking status timeout.")
result_file_directory = self.working_directory
if file_upload_parameters.result_file_directory is not None:
result_file_directory = file_upload_parameters.result_file_directory
download_result_file_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, file_upload_parameters.timeout_in_milliseconds)
result_file_path = operation.download_result_file(
result_file_directory=result_file_directory,
result_file_name=file_upload_parameters.result_file_name,
decompress=file_upload_parameters.decompress_result_file,
overwrite=file_upload_parameters.overwrite_result_file,
timeout_in_milliseconds=download_result_file_timeout,
)
return result_file_path
:param download_parameters: Determines various download parameters, for example where the file should be downloaded.
:type download_parameters: ReportingDownloadParameters
:return: The downloaded local reporting file path.
:rtype: str
"""
start_timestamp = _TimeHelper.get_current_time_milliseconds()
operation = self.submit_download(download_parameters.report_request)
try:
operation.track(download_parameters.timeout_in_milliseconds)
except TimeoutException:
raise ReportingDownloadException("Reporting file download tracking status timeout.")
result_file_directory = self.working_directory
if download_parameters.result_file_directory is not None:
result_file_directory = download_parameters.result_file_directory
download_result_file_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, download_parameters.timeout_in_milliseconds)
result_file_path = operation.download_result_file(
result_file_directory=result_file_directory,
result_file_name=download_parameters.result_file_name,
decompress=download_parameters.decompress_result_file,
overwrite=download_parameters.overwrite_result_file,
timeout_in_milliseconds=download_result_file_timeout,
)
return result_file_path
def upload_file(self, file_upload_parameters, progress=None):
""" Uploads the specified Bulk file.
:param file_upload_parameters: Determines various upload parameters.
:type file_upload_parameters: FileUploadParameters
:param progress: (optional) Tracking the percent complete progress information for the bulk operation.
:type progress: BulkOperationProgressInfo -> None
:return: The download local bulk file path.
:rtype: str
"""
start_timestamp = _TimeHelper.get_current_time_milliseconds()
file_upload_parameters._submit_upload_parameters.timeout_in_milliseconds = file_upload_parameters.timeout_in_milliseconds
operation = self.submit_upload(file_upload_parameters._submit_upload_parameters)
upload_operation_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, file_upload_parameters.timeout_in_milliseconds)
try:
operation.track(progress, upload_operation_timeout)
except TimeoutException:
raise BulkUploadException("Bulk file upload tracking status timeout.")
result_file_directory = self.working_directory
if file_upload_parameters.result_file_directory is not None:
result_file_directory = file_upload_parameters.result_file_directory
download_result_file_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, file_upload_parameters.timeout_in_milliseconds)
result_file_path = operation.download_result_file(
result_file_directory=result_file_directory,
result_file_name=file_upload_parameters.result_file_name,
decompress=file_upload_parameters.decompress_result_file,
overwrite=file_upload_parameters.overwrite_result_file,
timeout_in_milliseconds=download_result_file_timeout,
)
return result_file_path
:return: The download local bulk file path.
:rtype: str
"""
start_timestamp = _TimeHelper.get_current_time_milliseconds()
file_upload_parameters._submit_upload_parameters.timeout_in_milliseconds = file_upload_parameters.timeout_in_milliseconds
operation = self.submit_upload(file_upload_parameters._submit_upload_parameters)
upload_operation_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, file_upload_parameters.timeout_in_milliseconds)
try:
operation.track(progress, upload_operation_timeout)
except TimeoutException:
raise BulkUploadException("Bulk file upload tracking status timeout.")
result_file_directory = self.working_directory
if file_upload_parameters.result_file_directory is not None:
result_file_directory = file_upload_parameters.result_file_directory
download_result_file_timeout = _TimeHelper.get_remaining_time_milliseconds_with_min_value(start_timestamp, file_upload_parameters.timeout_in_milliseconds)
result_file_path = operation.download_result_file(
result_file_directory=result_file_directory,
result_file_name=file_upload_parameters.result_file_name,
decompress=file_upload_parameters.decompress_result_file,
overwrite=file_upload_parameters.overwrite_result_file,
timeout_in_milliseconds=download_result_file_timeout,
)
return result_file_path