Trend Micro Cloud One VSAPI SDK for python
Project description
Cloud One VSAPI SDK for Python
Cloud One VSAPI is a Software Development Kit (SDK) for Python, which allows Python developers to write software that makes use of Cloud One Antimalware Service.
Prerequisites
- Python 3.7 or newer
- CloudOne API Key
Installation
Install the VSAPI SDK package with pip:
python -m pip install cloudone-vsapi
Documentation
Documentation for the client SDK is available on Here and Read the Docs.
Run SDK
Example Usage
import json
import amaas.grpc
handle = amaas.grpc.init(YOUR_CLOUD_ONE_AMAAS_SERVER, YOUR_ClOUD_ONE_KEY, True)
result = amaas.grpc.scan_file(args.filename, handle)
print(result)
result_json = json.loads(result)
print("Got scan result: %d" % result_json['scanResult'])
amaas.grpc.quit(handle)
to use asyncio with coroutines and tasks,
import json
import pprint
import asyncio
import amaas.grpc.aio
async def scan_files():
handle = amaas.grpc.aio.init(YOUR_CLOUD_ONE_AMAAS_SERVER, YOUR_ClOUD_ONE_KEY, True)
tasks = [asyncio.create_task(amaas.grpc.aio.scan_file(file_name, handle))]
scan_results = await asyncio.gather(*tasks)
for scan_result in scan_results:
pprint.pprint(json.loads(scan_result))
await amaas.grpc.aio.quit(handle)
asyncio.run(scan_files())
Run with Cloud One VSAPI examples
-
Go to
/examples/
in current directory.cd examples/
-
There are two Python examples in the folder, one with regular file i/o and one with asynchronous file i/o
client_aio.py client.py
-
Current Python examples support following command line arguments
Command Line Arguments Value Optional --addr or -a antimalware.us-1.cloudone.trendmicro.com:443 No --api_key Cloud One <API KEY> No --filename or -f File to be scanned No -
Run one of the examples.
python3 client.py -f FILENAME -a ADDR --api_key API_KEY
or
python3 client_aio.py -f FILENAME -a ADDR --api_key API_KEY
More Resources
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
cloudone-vsapi-1.0.0.tar.gz
(9.7 kB
view hashes)
Built Distribution
Close
Hashes for cloudone_vsapi-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77216f67f9224bf7a9721c19f76d4918e6b09b103d59143dc315abeea3dd910c |
|
MD5 | 5c20c8cfbe01dcf3858cf82171201cd5 |
|
BLAKE2b-256 | 514a9faaea863c615efb108d111329adff8f2fb634b8fdcbcc6742224fb3dd9c |