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

Documentation

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

Installation

pip install wazuh-api-kit

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.1.0.tar.gz (52.6 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.1.0-py3-none-any.whl (108.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wazuh_api_kit-1.1.0.tar.gz
  • Upload date:
  • Size: 52.6 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.1.0.tar.gz
Algorithm Hash digest
SHA256 c6541c038068172ab0e55ded7c3687d86c419e7b958f1764cba1d1b331e98f4b
MD5 df3924432a9c08dbe1cc94cb06d8f066
BLAKE2b-256 eab78627f1c1ffbf1e5ebfc15a22f1a2882f94b32fce1fe1398073387e5a7429

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wazuh_api_kit-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 108.7 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23cfacde1e5f1c8c76ca3278caef2d5f86a054c448ddc86b19189aa6407de1b1
MD5 1e3e5e26708dc2579f9ee79789a0a0ee
BLAKE2b-256 abd92ea11e4c40b2663009fa9637645a195bbf882d711cdbdca85fb0a7c63f39

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