Trend Micro Cloud One VSAPI SDK for python
Project description
Trend 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 API.
Requirements
- Have an Trend Cloud One Account. Sign up for free trial now if it's not already the case!
- A Trend Cloud One API Key
- A Trend Cloud One Region of choice
- Python 3.7 or newer
- A file or object to be scan
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
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 --region or -r Trend Cloud One Region, such as: us-1 Yes, either -r or -a --addr or -a Trend Cloud One Amaas server, such as: antimalware.us-1.cloudone.trendmicro.com:443 Yes, either -r or -a --api_key Cloud One <API KEY> No --filename or -f File to be scanned No -
Run one of the examples.
The example program needs to be configured with your Cloud One account's secret key which is available in your Cloud One Dashboard. Set
API_KEY
from corresponding Cloud One Region to its value andFILENAME
to the target file:python3 client.py -f FILENAME -r us-1 --api_key API_KEY
or
using Antimalware Service server address
-a
instead of region-r
:python3 client.py -f FILENAME -a antimalware.us-1.cloudone.trendmicro.com:443 --api_key API_KEY
or
using asynchronous IO example program:
python3 client_aio.py -f FILENAME -a antimalware.us-1.cloudone.trendmicro.com:443 --api_key API_KEY
Code Examples
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())
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
Built Distribution
File details
Details for the file cloudone-vsapi-1.0.4.tar.gz
.
File metadata
- Download URL: cloudone-vsapi-1.0.4.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88f0473898d81f9b7bd532530b25112b8d5784d1c271c6b9ea8c5c3b1186c78a |
|
MD5 | fbe26150b2b69b6606360824d5807e97 |
|
BLAKE2b-256 | eeb6afd00c0ec447fb64c6552202a0439d6ccba381df4338acb54088376ba277 |
File details
Details for the file cloudone_vsapi-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: cloudone_vsapi-1.0.4-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f0998852f693bd7806399c721d274c73c18e8928a403bc24e9f3f82d3d23ee9 |
|
MD5 | d0d3cb518bdb429f98313aa411ffb05b |
|
BLAKE2b-256 | c3263a3df235e9e7963eaf6471deb7d36447a2ec23a0fba95ea3db272eed955c |