Skip to main content

An API Client to use Firemon RESTful API.

Project description

FiremonAPIClient

PyPI - Status PyPI - Format GitHub GitHub release (latest by date) PyPI - Python Version

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

FiremonAPIClient-0.0.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

FiremonAPIClient-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

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

Hashes for FiremonAPIClient-0.0.1.tar.gz
Algorithm Hash digest
SHA256 59035111646343a8c4a8a3be5626ba2f7286cfd9e3d482199c7af68f827139c7
MD5 7b973f051447722b736da94aedd73187
BLAKE2b-256 2e990f33bb24d0065a409286728ba35f1aebb07fa1d9aa8da981c14e66c58e02

See more details on using hashes here.

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

Hashes for FiremonAPIClient-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8543c7814ff1593c7850c202c24dd2c18f4d1698cd549c22ee0a9b44c9e9b551
MD5 9014b24248517712b1c9c7bd3e60e95a
BLAKE2b-256 6a768f906f87273a07badf5a1f4f13279e1995e5c4af94ccfa4ed860548bbd4e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page