Skip to main content

A library which provides tools and dataclasses, which allow to interact with the Wazuh API in a convenient and reliable way.

Project description

Wazuh API Kit

The Wazuh API kit Project equips you with the necessary tools for a flexible and reliable interaction with the Wazuh API.

The library’s core component, the WazuhApiConnection class, enables you to seamlessly file requests against the Wazuh API. Redundant tasks, such as authentication and refreshing authorization tokens, as well as common pitfalls, namely expired authorization tokens and rate limitations, are being taken care of.

Build on top of the WazuhApiConnection, the WazuhApiClient class provides methods, which abstracts API endpoints and translates their responses to well documented python objects.

Key Features

  • Automated authentication and authorization token renewal
  • Customizable rate limitation
  • Translated responses that allow you to work on Python objects rather than plain JSON dictionaries
  • Comprehensive error logging and deprecation warnings

Installation

pip install wazuh-api-kit

Documentation

For more information and examples take a look at our Documentation.

Usage Examples

Request the GET / endpoint (Get API Info) via the WazuhApiConnection class.

from http import HTTPMethod

from wazuh_api_kit import WazuhApiConnection
from wazuh_api_kit.model import WazuhResponse

connection: WazuhApiConnection = WazuhApiConnection(
    wazuh_api_url="https://localhost:55000",
    wazuh_api_username="wazuh",
    wazuh_api_password="wazuh",
    wazuh_api_insecure=True,
)

api_info: WazuhResponse = connection.request(
    method=HTTPMethod.GET,
    path="/"
)

print(api_info.data["api_version"])

Request the GET / endpoint (Get API Info) via the WazuhApiClient class.

from wazuh_api_kit import WazuhApiConnection, WazuhApiClient
from wazuh_api_kit.model import WazuhApiInfo

connection: WazuhApiConnection = WazuhApiConnection(
    wazuh_api_url="https://localhost:55000",
    wazuh_api_username="wazuh",
    wazuh_api_password="wazuh",
    wazuh_api_insecure=True,
)

api_client: WazuhApiClient = WazuhApiClient(
    wazuh_api_connection=connection
)

api_info: WazuhApiInfo = api_client.api_info_get()

print(api_info.version)

Contribute

Please read the Contribution guidelines before making contributions or submitting an issue.

License

The project is licensed under the MIT License.

Third party notices

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

wazuh_api_kit-1.0.0.tar.gz (51.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wazuh_api_kit-1.0.0-py3-none-any.whl (107.2 kB view details)

Uploaded Python 3

File details

Details for the file wazuh_api_kit-1.0.0.tar.gz.

File metadata

  • Download URL: wazuh_api_kit-1.0.0.tar.gz
  • Upload date:
  • Size: 51.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for wazuh_api_kit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9f8fc87adc823512fd04eff3916b8c277c96ae0e890a8dac6a9ba123ed3f3e8b
MD5 3c343af65280319ebcfa110b972af0c3
BLAKE2b-256 0cdee9ec3ec3d28f1fb3990c692de1e0d9c030ccda3b19f9841394174486a1b1

See more details on using hashes here.

File details

Details for the file wazuh_api_kit-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: wazuh_api_kit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 107.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for wazuh_api_kit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7d4798cf60dd5bd3a1f293a383fd8b770ec2496a45e4d5b4f7d36c96bf2c690
MD5 1eca83247a547f628bcb4c6853b3c845
BLAKE2b-256 576049a09be887717ad8058bd594b886c22d36a92eab61b885711197a01b0cdf

See more details on using hashes here.

Supported by

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