CyberWatch Api Tools.
Project description
[DEPRECATED]
New Api Client
This module has been deprecated. Please consider using cyberwatch_api.
Please contact Cyberwatch support if you need help to migrate your existing scripts to the new client.
Cyberwatch API toolbox
A simple interface for your Cyberwatch instance API composed of a python library and a command line program.
Installation
Prerequisites
Install the latest package
To install Cyberwatch API toolbox, simply use python 3 with:
$ pip3 install cbw-api-toolbox
Install an older package version
Some scripts from version 1.X may not work in version 2.X of cbw-api-toolbox
, to install an older version, simply do:
pip3 install cbw-api-toolbox==1.1.2
Test your installation
Create a new file called ping.py
and copy/paste this content
# ping.py
import os
from configparser import ConfigParser
from cbw_api_toolbox.cbw_api import CBWApi
CONF = ConfigParser()
CONF.read(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'api.conf'))
CLIENT = CBWApi(CONF.get('cyberwatch', 'url'), CONF.get('cyberwatch', 'api_key'), CONF.get('cyberwatch', 'secret_key'))
CLIENT.ping()
Configure an api.conf file with your credentials
See the Configuration section
Test your script
$ python3 ping.py
If everything is ok, the OK
message will appear
$ python3 ping.py
INFO:root:OK
Otherwise, the FAILED
message will appear
$ python3 ping.py
ERROR:root:FAILED
In this case, please check that there are no typing errors in your API_KEY
, SECRET_KEY
or API_URL
and that your Cyberwatch instance is up.
Configuration
Create an api.conf
file at the root of the project (see example_api.conf
)
api_key
: your Cyberwatch user api keysecret_key
: your Cyberwatch user secret keyurl
: your Cyberwatch instance URL
Example
[cyberwatch]
api_key = PyXpxrcJ7rQ...
secret_key = +bUx37WnB0qt...
url = https://myinstance.local
To find your API credentials:
- Click on your profile page in your cyberwatch instance web page
- Click on the button 'see my api keys'
Usage
Launch a script example
- Choose a script from the examples directory and copy it to your computer
- Edit the script with your API credentials (See Configuration)
- Launch the script
$ python3 your_example_script_file.py
API Documentation
See the full API documentation here
Command line Documentation
See the command line interface documentation here
Project details
Release history Release notifications | RSS feed
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 cbw-api-toolbox-2.3.2.tar.gz
.
File metadata
- Download URL: cbw-api-toolbox-2.3.2.tar.gz
- Upload date:
- Size: 49.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce0f3f67018b74132f592fc04be108b8be6dc7670c0a3245d693a25600c109e4 |
|
MD5 | 14fc7e3f65318c9756a1f94e42f1162e |
|
BLAKE2b-256 | edd21154e7d0b1c3c220d6fee9801fba0e471fa5d6848f780a617b48bcef75ae |
File details
Details for the file cbw_api_toolbox-2.3.2-py3-none-any.whl
.
File metadata
- Download URL: cbw_api_toolbox-2.3.2-py3-none-any.whl
- Upload date:
- Size: 90.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b27adf8f9349aea1c1f4a3655469f72ea820d9a335932ef7c48ee3643a3e22f6 |
|
MD5 | 4847f06bf1c7ab94d9d27f3484b1f9fd |
|
BLAKE2b-256 | 3e8195b2c2db4790920739ee4bdcf10ab7259ef5d5bf25da2b7149a8feb7268e |