Curator CLI Wrapper
curatorbin is a Python package that simplifies the installation and execution of the Elasticsearch Curator command-line interface. It downloads the `curator` binary during package installation and provides a Python interface to run its commands. The current version is 1.2.4, with releases typically aligned with updates of the underlying Curator binary or specific wrapper improvements.
Warnings
- gotcha curatorbin is a Python wrapper for the external `curator` command-line interface, not a pure Python client library for interacting with Elasticsearch. If you need to manage Elasticsearch indices programmatically with Python objects, consider using the `elasticsearch-py` library directly.
- gotcha During `pip install curatorbin`, the package attempts to download the `curator` binary from `https://download.elastic.co`. This process requires network access and appropriate file system permissions. Installation may fail or be slow if these conditions are not met.
- gotcha If another `curator` executable is already present in your system's PATH, there's a potential for conflict. `curatorbin` aims to use its managed binary, but relying on global PATH settings can lead to unexpected behavior if not carefully managed.
Install
-
pip install curatorbin
Imports
- run_curator_command
from curatorbin import run_curator_command
- main (CLI entry)
import curatorbin.cli curatorbin.cli.main()
Quickstart
from curatorbin import run_curator_command
# Example 1: Check the version of the underlying Curator binary
try:
stdout, stderr, exit_code = run_curator_command('--version')
print(f"Curator Version (stdout):\n{stdout.strip()}")
if stderr:
print(f"Curator Version (stderr):\n{stderr.strip()}")
if exit_code != 0:
print(f"Command '--version' failed with exit code {exit_code}")
# Example 2: Display Curator's help message (first few lines)
stdout, stderr, exit_code = run_curator_command('--help')
print("\nCurator Help (first 10 lines):\n" + "\n".join(stdout.splitlines()[:10]))
except Exception as e:
print(f"An error occurred during Curator command execution: {e}")