Skip to main content

A virus scan SDK for Python. Scan files for viruses, trojans, and other kinds of malware with attachmentAV.

Project description

attachmentav-sdk-python

A virus scan SDK for Python. Scan files for viruses, trojans, and other kinds of malware with attachmentAV.

Getting started

First, install the module.

pip install attachmentav-virus-malware-scan-sdk

Second, get an API key by subscribing to the attachmentAV API (SaaS).

Third, send a scan request. Make sure to replace the <API_KEY_PLACEHOLDER> placeholder.

import attachmentav

configuration = attachmentav.Configuration()
configuration.api_key['apiKeyAuth'] = "<API_KEY_PLACEHOLDER>"

with attachmentav.ApiClient(configuration) as api_client:
  api_instance = attachmentav.AttachmentAVApi(api_client)

  with open("path/to/file", "rb") as file:
    file_content = file.read()
    scan_result = api_instance.scan_sync_binary_post(file_content)
    print(scan_result)

The request returns a scan result similar to the following example.

{"status":"clean","size":"1024","realfiletype":"..."}

What is attachmentAV?

attachmentAV offers antivirus for SaaS and cloud platforms. Scan your files and attachments stored in the cloud for viruses, worms, and trojans. attachmentAV detects malware in real-time. Supports Amazon S3, Atlassian, Cloudflare R2, Salesforce, WordPress, and more.

The attachmentAV Virus and Malware Scan API provides a REST API that allows you to integrate malware scans into your application. The solution comes in two variants:

attachmentAV raises the bar for information security. Our solution is ISO 27001 certified and GDPR compliant. We are establishing, implementing, maintaining, and continually improving an information security management system (ISMS). Sensitive data is encrypted in transit as well as at rest and deleted immediately after processing. More than 1,000 customers trust our malware protection technology.

Install SDK

pip install attachmentav-virus-malware-scan-sdk

Configure SDK

Configure SDK (SaaS)

An active subscription and API key are required. Replace <API_KEY_PLACEHOLDER> with the API key.

import attachmentav

configuration = attachmentav.Configuration()
configuration.api_key['apiKeyAuth'] = "<API_KEY_PLACEHOLDER>"

with attachmentav.ApiClient(configuration) as api_client:
  api_instance = attachmentav.AttachmentAVApi(api_client)

Configure SDK (self-hosted on AWS)

When following the setup guide, you specified the ApiKeys parameter for the CloudFormation stack. Replace <API_KEY_PLACEHOLDER> with one of those keys.

import attachmentav

configuration = attachmentav.Configuration(
  host = "https://example.com/api/v1"
)
configuration.api_key['bearerAuth'] = "<API_KEY_PLACEHOLDER>"

with attachmentav.ApiClient(configuration) as api_client:
  api_instance = attachmentav.AttachmentAVApi(api_client)

Examples

Sync Scan: File

Send a file to the attachmentAV Virus Scan API and process the scan result.

See ScanResult for details.

The maximum file size is 10 MB. The request timeout is 60 seconds.

with open("path/to/file", "rb") as file:
  file_content = file.read()
  scan_result = api_instance.scan_sync_binary_post(file_content)
  print(scan_result)

Sync Scan: Download

Send a URL to the attachmentAV Virus Scan API. attachmentAV will download the file and return the scan result immediately.

See SyncDownloadScanRequest and ScanResult for details.

The maximum file size is 10 MB. The request timeout is 60 seconds.

sync_download_scan_request = attachmentav.SyncDownloadScanRequest(
  download_url = "https://example.com/demo.txt"
)
scan_result = api_instance.scan_sync_download_post(sync_download_scan_request)
print(scan_result)

Sync Scan: S3

Send an S3 bucket name and object key to the attachmentAV Virus Scan API. attachmentAV will download the file and return the scan result immediately.

See SyncS3ScanRequest and ScanResult for details.

The maximum file size is 10 MB. The request timeout is 60 seconds.

A bucket policy is required to grant attachmentAV access to private S3 objects.

sync_s3_scan_request = attachmentav.SyncS3ScanRequest(
  bucket = "example-bucket",
  key = "demo.txt"
)
scan_result = api_instance.scan_sync_s3_post(sync_s3_scan_request)
print(scan_result)

Async Scan: Download

Send a URL to the attachmentAV Virus Scan API. attachmentAV will send the scan result to the callback URL. See callback URL for details.

See AsyncDownloadScanRequest for details.

The maximum file size is 5 GB. The request timeout is 29 seconds; the asynchronous scan job is not affected by this limit.

Not supported by attachmentAV Virus Scan API (Self-hosted on AWS) yet. Contact hello@attachmentav.com to let us know, in case you need this feature.

async_download_scan_request = attachmentav.AsyncDownloadScanRequest(
  download_url = "https://example.com/demo.txt",
  callback_url = "https://example.com/callback"
)
api_instance.scan_async_download_post(async_download_scan_request)

Async Scan: S3

Send an S3 bucket name and object key to the attachmentAV Virus Scan API. attachmentAV will send the scan result to the callback URL. See callback URL for details.

See AsyncS3ScanRequest for details.

The maximum file size is 5 GB. The request timeout is 29 seconds; the asynchronous scan job is not affected by this limit.

A bucket policy is required to grant attachmentAV access to private S3 objects.

Not supported by attachmentAV Virus Scan API (Self-hosted on AWS) yet. Contact hello@attachmentav.com to let us know, in case you need this feature.

async_s3_scan_request = attachmentav.AsyncS3ScanRequest(
  bucket = "example-bucket",
  key = "demo.txt",
  callback_url = "https://example.com/callback"
)
api_instance.scan_async_s3_post(async_s3_scan_request)

Model

For more details about the data model, please refer to the following pages.

Need help?

Do you need any help to get started with attachmentAV? hello@attachmentav.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

attachmentav_virus_malware_scan_sdk-0.3.0.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file attachmentav_virus_malware_scan_sdk-0.3.0.tar.gz.

File metadata

File hashes

Hashes for attachmentav_virus_malware_scan_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 797d16ce0d865e6ba1ea4a6718a03eb00d0ef63d6be459839374816618a18d10
MD5 37f9348a012a0b4451ae4cd9b3fbeac2
BLAKE2b-256 60e3719e21b7d1b4b365b751ba4ebbf3fcf94cbac6c1d4eed8e3bc88737a12b9

See more details on using hashes here.

File details

Details for the file attachmentav_virus_malware_scan_sdk-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for attachmentav_virus_malware_scan_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d146ebf6fbf5519539d7f6cbdd63dfad24be63a0a51e5bd00b3041fb484470d
MD5 e566e4648e5f897fb3496f1a2be16f30
BLAKE2b-256 69e5f98a7e8ed29a353f6d7a1e43c816b0f13a25a438ebe65abe68d6085f5ece

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page