Lightweight Python client for the BlackBox HTTP API.
Project description
blackbox-py
Lightweight Python wrapper for the BlackBox HTTP API, mirroring the official JS client endpoints.
Install
pip install -e .
Quickstart
from blackbox_py import BlackBoxClient, BlackBoxError
client = BlackBoxClient(url="http://127.0.0.1", port=8080)
try:
print(client.health())
client.create_index({"name": "demo", "schema": {"fields": {"title": "text"}}})
client.index_document("demo", {"title": "hello"})
result = client.search("demo", {"q": "hello", "mode": "bm25"})
print(result)
except BlackBoxError as exc:
print("Request failed:", exc)
Common calls
- Health/config:
health(),metrics(),prometheus_metrics(),config() - Indexes:
create_index(body),list_indexes() - Snapshots/shipping:
save_snapshot(path=None),load_snapshot(path=None),ship_plan(),ship_apply(path),ship_fetch_apply(base) - Documents:
index_document(index, doc),bulk_index(index, docs, continue_on_error=True),get_document(index, id),replace_document(index, id, doc),update_document(index, id, doc),delete_document(index, id) - Search/stored:
search(index, params),stored_match(index, field=..., value=...) - Custom templates:
list_custom_templates(),get_custom_template(name),put_custom_template(name, template),execute_custom_template(name, params=None)
Tests
Install dev deps and run:
pip install -e .[dev]
pytest
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
blackbox_py-0.1.0.tar.gz
(4.8 kB
view details)
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 blackbox_py-0.1.0.tar.gz.
File metadata
- Download URL: blackbox_py-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
447f99c08467d0f0ac0e67e3f169f9d74cec10fede1ff69eff6058781b80ba15
|
|
| MD5 |
a85b1d3881ef28264d63bd21d884dc54
|
|
| BLAKE2b-256 |
5ff606d86745c85e52e18880a748a31b9f38cf16527920bce4b31787c8623286
|
File details
Details for the file blackbox_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: blackbox_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81d3c8ca7df73f7e39df1f3bd4e07a5f6288833aa34799990f180569466f5178
|
|
| MD5 |
7668d0f7b7abec4a1e3e57070e73169e
|
|
| BLAKE2b-256 |
5eba466090d0d73cac8e7bd537c2533cb35535d2a636a38b5ef414d099f28458
|