Beginner-friendly Stash GraphQL connection helpers
Project description
📦 stash‑connection‑lib
Beginner‑friendly helpers for Stash plugin developers to read a running
Stash server’s connection fragment, grab an (optional) local API key, and query
specific pieces of the configuration.general GraphQL tree—without needing to
learn the whole schema.
✨ Features
| Helper | Returns |
|---|---|
connect(fragment) |
StashConnection object (auto‑auth if API key exists) |
GET_STASH_API_KEY(fragment) |
Local API key (empty string if none) |
GET_STASH_BOXES(fragment) |
[ {endpoint, api_key, name}, … ] |
GET_STASHES(fragment) |
[ {path, excludeVideo, excludeImage}, … ] |
GET_PATHS(fragment) |
All path settings (databasePath, pluginsPath …) |
GET_SCRAPER_SOURCES(fragment) |
Community scraper sources list |
GET_PLUGIN_SOURCES(fragment) |
Plugin sources list |
Each call performs a single, minimal GraphQL query—no overfetching.
🛠 Installation
pip install stash-connection-lib
🚀 Quick‑start
from stash_connection_lib import (
GET_STASH_API_KEY, GET_STASH_BOXES, GET_PATHS
)
# `fragment` is the JSON object Stash passes to a plugin’s stdin
api_key = GET_STASH_API_KEY(fragment)
boxes = GET_STASH_BOXES(fragment)
paths = GET_PATHS(fragment)
print("API key:", api_key)
for b in boxes:
print(b["name"], "→", b["endpoint"])
print("Database located at:", paths["databasePath"])
🧩 How it works
StashConnection.from_fragment(fragment) builds a requests.Session
pointed at http(s)://Host:Port/graphql, populating cookies if provided.
authenticate() queries apiKey; failures are swallowed so the lib
still works on servers without an API key.
Helper functions compose tiny GraphQL queries for one subsection each.
Responses are returned as plain Python dictionaries/lists—no extra models.
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
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 stash_connection_lib-0.1.0.tar.gz.
File metadata
- Download URL: stash_connection_lib-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec0b690fcce183a462bda07a064b919bd1b66d9fffbc4b712189fd37e585c06d
|
|
| MD5 |
36710ae65b9a36de0d8aaa515546d63b
|
|
| BLAKE2b-256 |
5cf09332ddd839d7bfc4fdf50c4ed1a8c9e2db18798a6c08ebb8c3f23bd7aa57
|
File details
Details for the file stash_connection_lib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: stash_connection_lib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
619b4569c71bd95773e6bb26d02a1d9cf7b9fc68bc8b7f17ba130cb315647e9b
|
|
| MD5 |
7b8007930bdac2e1e2692660f3cf7cdb
|
|
| BLAKE2b-256 |
974de3617ec25ea65f11eccfa949d8f10b80b0555d84b2c88484bf613f1c3efd
|