Skip to main content

Sanitize | Python SDK

init

Sanitize()

download-file

Sanitize.download_file()

Poll result

Sanitize.poll_result(exception)

Returns request's result that has been accepted by the server

required parameters

AcceptedRequestException

Exception raise by SDK on the call that is been processed.

Response Object

PangeaResponse

response = service.poll_result(exception)

Sanitize via presigned URL (Beta)

Sanitize.request_upload_url(transfer_method, params, file_scan, content, share_output, size, crc32c, sha256, uploaded_file_name)

Apply file sanitization actions according to specified rules via a presigned URL. How to install a Beta release.

optional parameters

The transfer method used to upload the file data.

File upload parameters.

Options for File Scan.

Options for how the file should be sanitized.

Integration with Secure Share.

The size (in bytes) of the file. If the upload doesn't match, the call will fail.

The CRC32C hash of the file data, which will be verified by the server if provided.

The hexadecimal-encoded SHA256 hash of the file data, which will be verified by the server if provided.

Name of the user-uploaded file, required for TransferMethod.PUT_URL and TransferMethod.POST_URL.

Response Object

A presigned URL.

presignedUrl = sanitize.request_upload_url(
    transfer_method=TransferMethod.PUT_URL,
    uploaded_file_name="uploaded_file",
)

# Upload file to `presignedUrl.accepted_result.put_url`.

# Poll for Sanitize's result.
response: PangeaResponse[SanitizeResult] = sanitize.poll_result(response=presignedUrl)

Sanitize (Beta)

Sanitize.sanitize(transfer_method, file_path, file, source_url, share_id, file_scan, content, share_output, size, crc32c, sha256, uploaded_file_name, sync_call)

Apply file sanitization actions according to specified rules. How to install a Beta release.

optional parameters

The transfer method used to upload the file data.

Path to file to sanitize.

File to sanitize.

A URL where the file to be sanitized can be downloaded.

A Pangea Secure Share ID where the file to be sanitized is stored.

Options for File Scan.

Options for how the file should be sanitized.

Integration with Secure Share.

The size (in bytes) of the file. If the upload doesn't match, the call will fail.

The CRC32C hash of the file data, which will be verified by the server if provided.

The hexadecimal-encoded SHA256 hash of the file data, which will be verified by the server if provided.

Name of the user-uploaded file, required for TransferMethod.PUT_URL and TransferMethod.POST_URL.

Whether or not to poll on HTTP/202.

Response Object

The sanitized file and information on the sanitization that was performed.

with open("/path/to/file.pdf", "rb") as f:
response = sanitize.sanitize(
    file=f,
    transfer_method=TransferMethod.POST_URL,
    uploaded_file_name="uploaded_file",
)