Skip to main content

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-py-sdk

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

slugkit_py_sdk-0.0.2.tar.gz (210.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slugkit_py_sdk-0.0.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file slugkit_py_sdk-0.0.2.tar.gz.

File metadata

  • Download URL: slugkit_py_sdk-0.0.2.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

Hashes for slugkit_py_sdk-0.0.2.tar.gz
Algorithm Hash digest
SHA256 022def19a7bd18f91de8e2a17c1fa7725b86b3f310ec6e941aded42c32c5c174
MD5 42fd1708d5ad2feadae3fbe07c1a99df
BLAKE2b-256 828214ee39f7120ce5b148f7f6d426d007a0dd71aec0b36435a77491e670f6be

See more details on using hashes here.

File details

Details for the file slugkit_py_sdk-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: slugkit_py_sdk-0.0.2-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

Hashes for slugkit_py_sdk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cf70a52d8bf66cc76af69670d1af6eeecc991a71403c1b36aa4bc4f4dec902e6
MD5 19fd69a72bb2f24ed7dbba329b570178
BLAKE2b-256 d79169d285cee8a8eecc7f560d7f537755f5f7b2b9f0a4bcf6607666fae0ce85

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