An API Client to use Firemon RESTful API.
Project description
FiremonAPIClient
An API Client for Firemon to be able to easily use the API in a more standard way.
How to install
$ pip install FiremonAPIClient
Usage
the argument "method" must be specify everytime. Look at authentication validation for an example.
Default arguments and attributes
import FiremonAPIClient
client = FiremonAPIClient.Client(verify=False, warnings=False, api_version='v1')
client.get(url=None, method='', data=None, auth = None)
# client.headers
# client.url_base
# client.token
Import and instantiate the class
import FiremonAPIClient
client = FiremonAPIClient.Client()
Connect, Validate authentication and Disconnect
import FiremonAPIClient
import json
client = FiremonAPIClient.Client()
client.connect(url='https://firemon-server.local', username='admin', password='Admin123')
response = client.post(method='/authentication/validate', data={'username': 'admin', 'password': 'Admin123'})
print(json.dumps(response.json(), indent=4), response.status_code, response.reason)
client.disconnect()
How to get an object
import FiremonAPIClient
import json
client = FiremonAPIClient.Client()
client.connect(url='https://firemon-server.local', username='admin', password='Admin123')
domain_id = 1
group_name = 'mytestgroup'
response = client.get(method=f'/domain/{domain_id}/usergroup/name/{group_name}')
print(json.dumps(response.json(), indent=4), response.status_code, response.reason)
client.disconnect()
How to create an object
import FiremonAPIClient
import json
client = FiremonAPIClient.Client()
client.connect(url='https://firemon-server.local', username='admin', password='Admin123')
domain_id = 1
group_name = 'mytestgroup'
response = client.post(method=f'/domain/{domain_id}/usergroup', domainId=domain_id, data={
"name": group_name, "description": "This group is a test and can be deleted"})
print(json.dumps(response.json(), indent=4), response.status_code, response.reason)
client.disconnect()
How to update an object
import FiremonAPIClient
client = FiremonAPIClient.Client()
client.connect(url='https://firemon-server.local', username='admin', password='Admin123')
domain_id = 1
group_id = 123
group_name = 'mytestgroup'
response = client.put(method=f'/domain/{domain_id}/usergroup/{group_id}', domainId=domain_id, id=group_id,
data={"id": group_id, "domainId": domain_id, "name": group_name,
"description": "This group is a test and it has been updated and can be deleted"})
print(response.status_code, response.reason)
client.disconnect()
How to delete an object
import FiremonAPIClient
client = FiremonAPIClient.Client()
client.connect(url='https://firemon-server.local', username='admin', password='Admin123')
domain_id = 1
group_id = 123
response = client.delete(method=f'/domain/{domain_id}/usergroup/{group_id}', domainId=domain_id, id=group_id)
print(response.status_code, response.reason)
client.disconnect()
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file FiremonAPIClient-0.0.1.tar.gz.
File metadata
- Download URL: FiremonAPIClient-0.0.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59035111646343a8c4a8a3be5626ba2f7286cfd9e3d482199c7af68f827139c7
|
|
| MD5 |
7b973f051447722b736da94aedd73187
|
|
| BLAKE2b-256 |
2e990f33bb24d0065a409286728ba35f1aebb07fa1d9aa8da981c14e66c58e02
|
File details
Details for the file FiremonAPIClient-0.0.1-py3-none-any.whl.
File metadata
- Download URL: FiremonAPIClient-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8543c7814ff1593c7850c202c24dd2c18f4d1698cd549c22ee0a9b44c9e9b551
|
|
| MD5 |
9014b24248517712b1c9c7bd3e60e95a
|
|
| BLAKE2b-256 |
6a768f906f87273a07badf5a1f4f13279e1995e5c4af94ccfa4ed860548bbd4e
|