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.2.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.2.0
File Size Uploaded
openavaban-0.2.0.tar.gz 5.7 kB Details

Built distribution (wheel)

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

Total release size: 11.5 kB

Release files / openavaban-0.2.0.tar.gz

Download URL openavaban-0.2.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ab22b96f7f5a34d339aab4de68938dc9e0bf27bb6bd2582b9e4879360da84919
BLAKE2b-256 checksum
How to use checksums
21fdf08545d980e5a976defdb8092462d5ca282437dbfda14e896b29f41a8b2e
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.2.0-py3-none-any.whl

Download URL openavaban-0.2.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86de124b8f3ec9fde9164af0b75a070019fcd2210072a880e1aacaabf2f0fe5d
BLAKE2b-256 checksum
How to use checksums
4b25689396137563e0b5107913cc5ddab96d44203b1bc7fb4a5df316fdc75d92
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

0.3.0

2 release files

This release

0.2.0 This release

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