# 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.
```sh
pip install attachmentav-virus-malware-scan-sdk
```
Second, get an API key by [subscribing to the attachmentAV API (SaaS)](https://attachmentav.com/subscribe/api/).
Third, send a scan request. Make sure to replace the `<API_KEY_PLACEHOLDER>` placeholder.
```python
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](https://attachmentav.com) 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](https://attachmentav.com/solution/virus-malware-scan-api/) provides a REST API that allows you to integrate malware scans into your application. The solution comes in two variants:
* [attachmentAV Virus Scan API (SaaS)](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/): Get started quickly with a fully managed service.
* [attachmentAV Virus Scan API (self-hosted on AWS)](https://attachmentav.com/help/virus-malware-scan-api-aws/setup-guide/): Deploy the production-ready API on AWS.
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
```sh
pip install attachmentav-virus-malware-scan-sdk
```
## Configure SDK
### Configure SDK (SaaS)
An [active subscription and API key](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/#api-key) are required. Replace `<API_KEY_PLACEHOLDER>` with the API key.
```python
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.
```python
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](sdk/docs/ScanResult.md) for details.
The maximum file size is 10 MB. The request timeout is 60 seconds.
```python
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](sdk/docs/SyncDownloadScanRequest.md) and [ScanResult](sdk/docs/ScanResult.md) for details.
The maximum file size is 10 MB. The request timeout is 60 seconds.
```python
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](sdk/docs/SyncS3ScanRequest.md) and [ScanResult](sdk/docs/ScanResult.md) for details.
The maximum file size is 10 MB. The request timeout is 60 seconds.
> A [bucket policy](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/#s3-bucket-policy) is required to grant attachmentAV access to private S3 objects.
```python
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](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/#callback-url) for details.
See [AsyncDownloadScanRequest](sdk/docs/AsyncDownloadScanRequest.md) 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](hello@attachmentav.com) to let us know, in case you need this feature.
```python
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](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/#callback-url) for details.
See [AsyncS3ScanRequest](sdk/docs/AsyncS3ScanRequest.md) 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](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/#s3-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](hello@attachmentav.com) to let us know, in case you need this feature.
```javascript
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.
* [AsyncDownloadScanRequest](sdk/docs/AsyncDownloadScanRequest.md)
* [AsyncS3ScanRequest](sdk/docs/AsyncS3ScanRequest.md)
* [AttachmentAVApi](sdk/docs/AttachmentAVApi.md)
* [ScanResult](sdk/docs/ScanResult.md)
* [SyncDownloadScanRequest](sdk/docs/SyncDownloadScanRequest.md)
* [SyncS3ScanRequest](sdk/docs/SyncS3ScanRequest.md)
## Need help?
Do you need any help to get started with attachmentAV? [hello@attachmentav.com](mailto:hello@attachmentav.com).
Raw data
{
"_id": null,
"home_page": null,
"name": "attachmentav-virus-malware-scan-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "virus, malware, scan, scanner, sdk",
"author": "OpenAPI Generator community",
"author_email": "Andreas Wittig <andreas@attachmentav.com>",
"download_url": "https://files.pythonhosted.org/packages/0b/a1/3811bf5651eddc35c3cf11a6725d25102922305aaafc570739210540bd53/attachmentav_virus_malware_scan_sdk-0.2.0.tar.gz",
"platform": null,
"description": "# attachmentav-sdk-python\n\nA virus scan SDK for Python. Scan files for viruses, trojans, and other kinds of malware with attachmentAV.\n\n## Getting started\n\nFirst, install the module.\n\n```sh\npip install attachmentav-virus-malware-scan-sdk\n```\n\nSecond, get an API key by [subscribing to the attachmentAV API (SaaS)](https://attachmentav.com/subscribe/api/).\n\nThird, send a scan request. Make sure to replace the `<API_KEY_PLACEHOLDER>` placeholder.\n\n```python\nimport attachmentav\n\nconfiguration = attachmentav.Configuration()\nconfiguration.api_key['apiKeyAuth'] = \"<API_KEY_PLACEHOLDER>\"\n\nwith attachmentav.ApiClient(configuration) as api_client:\n api_instance = attachmentav.AttachmentAVApi(api_client)\n\n with open(\"path/to/file\", \"rb\") as file:\n file_content = file.read()\n scan_result = api_instance.scan_sync_binary_post(file_content)\n print(scan_result)\n```\n\nThe request returns a scan result similar to the following example.\n\n```\n{\"status\":\"clean\",\"size\":\"1024\",\"realfiletype\":\"...\"}\n```\n\n## What is attachmentAV?\n\n[attachmentAV](https://attachmentav.com) 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.\n\nThe [attachmentAV Virus and Malware Scan API](https://attachmentav.com/solution/virus-malware-scan-api/) provides a REST API that allows you to integrate malware scans into your application. The solution comes in two variants:\n\n* [attachmentAV Virus Scan API (SaaS)](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/): Get started quickly with a fully managed service.\n* [attachmentAV Virus Scan API (self-hosted on AWS)](https://attachmentav.com/help/virus-malware-scan-api-aws/setup-guide/): Deploy the production-ready API on AWS.\n\nattachmentAV 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.\n\n## Install SDK\n\n```sh\npip install attachmentav-virus-malware-scan-sdk\n```\n\n## Configure SDK\n\n### Configure SDK (SaaS)\n\nAn [active subscription and API key](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/#api-key) are required. Replace `<API_KEY_PLACEHOLDER>` with the API key.\n\n```python\nimport attachmentav\n\nconfiguration = attachmentav.Configuration()\nconfiguration.api_key['apiKeyAuth'] = \"<API_KEY_PLACEHOLDER>\"\n\nwith attachmentav.ApiClient(configuration) as api_client:\n api_instance = attachmentav.AttachmentAVApi(api_client)\n```\n\n### Configure SDK (self-hosted on AWS)\n\nWhen following the setup guide, you specified the `ApiKeys` parameter for the CloudFormation stack. Replace `<API_KEY_PLACEHOLDER>` with one of those keys. \n\n```python\nimport attachmentav\n\nconfiguration = attachmentav.Configuration(\n host = \"https://example.com/api/v1\"\n)\nconfiguration.api_key['bearerAuth'] = \"<API_KEY_PLACEHOLDER>\"\n\nwith attachmentav.ApiClient(configuration) as api_client:\n api_instance = attachmentav.AttachmentAVApi(api_client)\n\n```\n\n## Examples\n\n\n### Sync Scan: File\n\nSend a file to the attachmentAV Virus Scan API and process the scan result.\n\nSee [ScanResult](sdk/docs/ScanResult.md) for details.\n\nThe maximum file size is 10 MB. The request timeout is 60 seconds.\n\n\n```python\nwith open(\"path/to/file\", \"rb\") as file:\n file_content = file.read()\n scan_result = api_instance.scan_sync_binary_post(file_content)\n print(scan_result)\n```\n\n### Sync Scan: Download\n\nSend a URL to the attachmentAV Virus Scan API. attachmentAV will download the file and return the scan result immediately.\n\n\nSee [SyncDownloadScanRequest](sdk/docs/SyncDownloadScanRequest.md) and [ScanResult](sdk/docs/ScanResult.md) for details.\n\nThe maximum file size is 10 MB. The request timeout is 60 seconds.\n\n\n```python\nsync_download_scan_request = attachmentav.SyncDownloadScanRequest(\n download_url = \"https://example.com/demo.txt\"\n)\nscan_result = api_instance.scan_sync_download_post(sync_download_scan_request)\nprint(scan_result)\n```\n\n### Sync Scan: S3\n\nSend an S3 bucket name and object key to the attachmentAV Virus Scan API. attachmentAV will download the file and return the scan result immediately.\n\nSee [SyncS3ScanRequest](sdk/docs/SyncS3ScanRequest.md) and [ScanResult](sdk/docs/ScanResult.md) for details.\n\nThe maximum file size is 10 MB. The request timeout is 60 seconds.\n\n> A [bucket policy](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/#s3-bucket-policy) is required to grant attachmentAV access to private S3 objects.\n\n```python\nsync_s3_scan_request = attachmentav.SyncS3ScanRequest(\n bucket = \"example-bucket\",\n key = \"demo.txt\"\n)\nscan_result = api_instance.scan_sync_s3_post(sync_s3_scan_request)\nprint(scan_result)\n```\n\n### Async Scan: Download\n\nSend a URL to the attachmentAV Virus Scan API. attachmentAV will send the scan result to the callback URL. See [callback URL](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/#callback-url) for details.\n\nSee [AsyncDownloadScanRequest](sdk/docs/AsyncDownloadScanRequest.md) for details.\n\nThe maximum file size is 5 GB. The request timeout is 29 seconds; the asynchronous scan job is not affected by this limit.\n\n> Not supported by attachmentAV Virus Scan API (Self-hosted on AWS) yet. Contact [hello@attachmentav.com](hello@attachmentav.com) to let us know, in case you need this feature. \n\n```python\nasync_download_scan_request = attachmentav.AsyncDownloadScanRequest(\n download_url = \"https://example.com/demo.txt\",\n callback_url = \"https://example.com/callback\"\n)\napi_instance.scan_async_download_post(async_download_scan_request)\n```\n\n### Async Scan: S3\n\nSend 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](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/#callback-url) for details.\n\nSee [AsyncS3ScanRequest](sdk/docs/AsyncS3ScanRequest.md) for details.\n\nThe maximum file size is 5 GB. The request timeout is 29 seconds; the asynchronous scan job is not affected by this limit.\n\n> A [bucket policy](https://attachmentav.com/help/virus-malware-scan-api/setup-guide/#s3-bucket-policy) is required to grant attachmentAV access to private S3 objects.\n\n> Not supported by attachmentAV Virus Scan API (Self-hosted on AWS) yet. Contact [hello@attachmentav.com](hello@attachmentav.com) to let us know, in case you need this feature.\n\n```javascript\nasync_s3_scan_request = attachmentav.AsyncS3ScanRequest(\n bucket = \"example-bucket\",\n key = \"demo.txt\",\n callback_url = \"https://example.com/callback\"\n)\napi_instance.scan_async_s3_post(async_s3_scan_request)\n```\n\n## Model\n\nFor more details about the data model, please refer to the following pages.\n\n* [AsyncDownloadScanRequest](sdk/docs/AsyncDownloadScanRequest.md)\n* [AsyncS3ScanRequest](sdk/docs/AsyncS3ScanRequest.md)\n* [AttachmentAVApi](sdk/docs/AttachmentAVApi.md)\n* [ScanResult](sdk/docs/ScanResult.md)\n* [SyncDownloadScanRequest](sdk/docs/SyncDownloadScanRequest.md)\n* [SyncS3ScanRequest](sdk/docs/SyncS3ScanRequest.md)\n\n## Need help?\n\nDo you need any help to get started with attachmentAV? [hello@attachmentav.com](mailto:hello@attachmentav.com).\n",
"bugtrack_url": null,
"license": null,
"summary": "A virus scan SDK for Python. Scan files for viruses, trojans, and other kinds of malware with attachmentAV.",
"version": "0.2.0",
"project_urls": {
"Repository": "https://github.com/widdix/attachmentav-sdk-python"
},
"split_keywords": [
"virus",
" malware",
" scan",
" scanner",
" sdk"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "ae6dfbeafba556ff404e3102e6bbb9f59bb6fcf7418792e9dde8c040c8281175",
"md5": "8bc7487c77c6001e56f5e5f8646907b7",
"sha256": "e64ed2fe196d00db4f351bd8e93327d18c9dc0dc85c3ae1984f857a8aee6e0dd"
},
"downloads": -1,
"filename": "attachmentav_virus_malware_scan_sdk-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8bc7487c77c6001e56f5e5f8646907b7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 31933,
"upload_time": "2025-07-17T18:50:23",
"upload_time_iso_8601": "2025-07-17T18:50:23.792919Z",
"url": "https://files.pythonhosted.org/packages/ae/6d/fbeafba556ff404e3102e6bbb9f59bb6fcf7418792e9dde8c040c8281175/attachmentav_virus_malware_scan_sdk-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0ba13811bf5651eddc35c3cf11a6725d25102922305aaafc570739210540bd53",
"md5": "bad79c9d9dc206aa57667d34bcd0a4ed",
"sha256": "74711c12930be7c3c14baa6f6a354876f6689f00feed5f3ee719899e2ae92ab7"
},
"downloads": -1,
"filename": "attachmentav_virus_malware_scan_sdk-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "bad79c9d9dc206aa57667d34bcd0a4ed",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 26899,
"upload_time": "2025-07-17T18:50:24",
"upload_time_iso_8601": "2025-07-17T18:50:24.958198Z",
"url": "https://files.pythonhosted.org/packages/0b/a1/3811bf5651eddc35c3cf11a6725d25102922305aaafc570739210540bd53/attachmentav_virus_malware_scan_sdk-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-17 18:50:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "widdix",
"github_project": "attachmentav-sdk-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "attachmentav-virus-malware-scan-sdk"
}