A simple interface for your Cyberwatch instance API.
To install Cyberwatch API toolbox, simply use python 3 with:
$ pip3 install git+https://github.com/Cyberwatch/cyberwatch_api_toolbox
Create a new file called ping.py
and copy/paste this content
# ping.py
from cbw_api_toolbox.cbw_api import CBWApi
API_KEY = ''
SECRET_KEY = ''
API_URL = ''
CBWApi(API_URL, API_KEY, SECRET_KEY).ping()
Configure the 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.
API_KEY
: your Cyberwatch user api keySECRET_KEY
: your Cyberwatch user secret keyAPI_URL
: your Cyberwatch instance URL
Example
API_KEY = 'PyXpxrcJ7rQ...'
SECRET_KEY = '+bUx37WnB0qt...'
API_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'
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