Skip to main content

openavaban

Python SDK for the openavaban REST API — manage profile avatars and banners via UploadThing and MongoDB.

Installation

pip install openavaban

Quick Start

1. Set up credentials

OPENAVABAN_API_URL=https://your-api.vercel.app
OPENAVABAN_API_KEY=your-api-key

2. Initialize the client

from openavaban import OpenavaBan

# Option 1: Auto-load from .env
client = OpenavaBan()

# Option 2: Pass directly
client = OpenavaBan(
    api_url="https://your-api.vercel.app",
    api_key="your-api-key"
)

Usage

Upload an avatar

avatar = client.upload(
    file="photo.jpg",
    name="Profile Photo",
    class_type="avatar",       # "avatar" or "banner"
    user_id="user_123",
    category="profile",
    tags=["main", "profile"]
)

print(avatar["url"])  # CDN URL

Get user's avatar

avatar = client.get(user_id="user_123", class_type="avatar")

Get all user's images

images = client.get_all(user_id="user_123")

Get image by ID

image = client.get_by_id("64f1a2b3...")

Update an image

client.update(
    image_id="64f1a2b3...",
    name="New Name",
    tags=["updated", "v2"]
)

Delete an image

client.delete("64f1a2b3...")

Query images

results = client.query(
    user_id="user_123",
    class_type="avatar",
    category="profile",
    tags=["main"]
)

Response Format

{
    "id": "64f1a2b3...",
    "name": "Profile Photo",
    "class_type": "avatar",
    "category": "profile",
    "url": "https://your-app-id.ufs.sh/f/...",
    "user_id": "user_123",
    "created_at": "2026-08-09T10:00:00+00:00",
    "updated_at": "2026-08-09T10:00:00+00:00",
    "file_size": 102400,
    "mime_type": "image/jpeg",
    "tags": ["main", "profile"],
    "metadata": {},
    "dimensions": {"width": 800, "height": 600}
}

Exceptions

Exception Description
ConfigError Missing API URL or key
UploadError Upload failed
InvalidClassError Invalid class_type (must be "avatar" or "banner")
NotFoundError Image not found
ValidationError Invalid file type or missing fields

Environment Variables

Variable Description
OPENAVABAN_API_URL Your Vercel API URL
OPENAVABAN_API_KEY Your API key

License

MIT

Metadata

Release files for openavaban 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openavaban 0.3.0
File Size Uploaded
openavaban-0.3.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openavaban 0.3.0
File Interpreter ABI Platform
openavaban-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.5 kB

Release files / openavaban-0.3.0.tar.gz

Download URL openavaban-0.3.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4b1614dc683f9edb6e94e58569eb6b3c7b04a6700d50aeff3844dc3bcb63aa5f
BLAKE2b-256 checksum
How to use checksums
a5697ae579ad36d3987f73d621fbfef4f6ecb96f63a08ba324eadae16661b26c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / openavaban-0.3.0-py3-none-any.whl

Download URL openavaban-0.3.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8281d4f68672d50a25c67fae34f766311882f8bd629e25dc8300f4f5b873fbc9
BLAKE2b-256 checksum
How to use checksums
1919a549b0b204929d2b6ad1ef0902b398226137c24a629960a9d7d2b207b181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

1.0.0

2 release files

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page