SlugKit Python SDK
Project description
SlugKit Python SDK
A Python SDK for generating human-readable IDs using SlugKit.dev service.
Please see SlugKit documentation for information on creating projects and obtaining API keys.
Installation
pip install slugkit
API Overview
The SDK provides a simple interface to generate human-readable IDs and test patterns.
Basic Usage
from slugkit import SyncClient
# Initialize the client
client = SyncClient(
base_url="https://dev.slugkit.dev/api/v1",
api_key="your-api-key"
)
# Generate a single ID
id = client.generator()[0]
# Generate multiple IDs
ids = client.generator(count=5)
# Get generator stats
stats = client.generator.stats()
# Reset the generator
client.generator.reset()
Pattern Testing
from slugkit import PatternTester
import httpx
# Initialize the tester
client = slugkit.SyncClient(base_url="https://dev.slugkit.dev/api/v1")
# Test a pattern
ids = client.test(
pattern="your-pattern",
seed="optional-seed",
sequence=1,
count=5
)
Command Line Interface
The SDK includes a command-line interface for easy usage:
Generate IDs
# Generate a single ID
slugkit next
# Generate multiple IDs
slugkit next 5
# Generate IDs with custom batch size
slugkit next 10 --batch-size 2
Test Patterns
# Test a pattern
slugkit pattern-test "your-pattern"
# Test with specific seed and sequence
slugkit pattern-test "your-pattern" --seed "my-seed" --sequence 1
# Generate multiple test IDs
slugkit pattern-test "your-pattern" --count 5
Generator Management
# Get generator stats
slugkit stats
# Reset the generator
slugkit reset
Configuration
The CLI can be configured using environment variables or command-line options:
# Set base URL
export SLUGKIT_BASE_URL="https://dev.slugkit.dev/api/v1"
# Set API key
export SLUGKIT_API_KEY="your-api-key"
# Or use command-line options
slugkit --base-url "https://dev.slugkit.dev/api/v1" --api-key "your-api-key" next
Output Format
The CLI supports different output formats:
# Text output (default)
slugkit next
# JSON output
slugkit next --output-format json
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
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 slugkit_py_sdk-0.0.1.tar.gz.
File metadata
- Download URL: slugkit_py_sdk-0.0.1.tar.gz
- Upload date:
- Size: 210.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af2c6fa4bfdda2e2aa315af8877b09e02ca15221c3c8da023054fd777695a9c7
|
|
| MD5 |
a54902ab5a5aa2f670a7dc00532704f0
|
|
| BLAKE2b-256 |
faeac1b51e3ea9ffdc43cb9c45436703f59016331e47ff9c7f61bcac44786c71
|
File details
Details for the file slugkit_py_sdk-0.0.1-py3-none-any.whl.
File metadata
- Download URL: slugkit_py_sdk-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f94a98fa712dc86a1982802936b118bedcb0e0a4e28ffef66ab1806e7d0c8e6
|
|
| MD5 |
037cb16d1aa08736e29d2a8dde339737
|
|
| BLAKE2b-256 |
d0c781b19b12b1678298e586cc0f9c4ca3a1a82a665c46f52c41d8291f30ba65
|