Skip to main content

optivor (Python SDK)

Official Python SDK for Optivor image optimization engine (Django, FastAPI, Flask).

PyPI version License

The optivor Python package provides helper methods for building signed and dynamic image transformation URLs.


Installation

pip install optivor

Basic Usage

from optivor import OptivorClient

optivor = OptivorClient(
    base_url="https://optivor.example.com",
    default_bucket="my-bucket"
)

```python
# Preset-based image optimization (Recommended)
preset_url = optivor.build_preset_url("avatar", "users/john.jpg")
# => https://optivor.example.com/preset/avatar/my-bucket/users/john.jpg

# Generate WebP image URL
url = optivor.build_url(
    "photos/landscape.jpg",
    width=800,
    height=600,
    fit="cover",
    format="webp"
)
# => https://optivor.example.com/image/my-bucket/photos/landscape.jpg?w=800&h=600&fit=cover&format=webp

Advanced Options

url = optivor.build_url(
    "users/avatar.jpg",
    width=400,
    height=400,
    fit="focal",
    focal=(0.3, 0.7),
    format="avif",
    overlay="logo.png",
    gravity="bottom_right",
    opacity=60,
    blur=5.0,
    grayscale=True,
    pixelate=4
)

Django Integration Example

# settings.py
OPTIVOR_URL = "https://optivor.example.com"
OPTIVOR_BUCKET = "prod-images"

# templatetags/optivor_tags.py
from django import template
from optivor import OptivorClient
from django.conf import settings

register = template.Library()
optivor = OptivorClient(settings.OPTIVOR_URL, settings.OPTIVOR_BUCKET)

@register.simple_tag
def optivor_url(key, **kwargs):
    return optivor.build_url(key, **kwargs)

License

Apache-2.0 © Optivor Team

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

optivor-1.2.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

optivor-1.2.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file optivor-1.2.1.tar.gz.

File metadata

  • Download URL: optivor-1.2.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for optivor-1.2.1.tar.gz
Algorithm Hash digest
SHA256 85a1b1889a06997f97aad99747331c70e870f947db56dc36162a24ba2b2c0244
MD5 0a3fbf0dcaf720464368757b31272b3c
BLAKE2b-256 857501bde69553ae2d1249f0ca03e75ca9ab3444dd654b2fbc175d377dce8841

See more details on using hashes here.

File details

Details for the file optivor-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: optivor-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for optivor-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cefd1724a5cf83a36a6f81b92a2b28792d9fd649f745522a2ac962be739c556f
MD5 29e28b2d93820f361e6027eda2c09424
BLAKE2b-256 e7ae0aaa354d1777c5530c850dccc361bbfd8008cf92c3fd731c764d57b8a25d

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.3

2 files

This release

1.2.1 This release

2 files

1.2.0

2 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