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"
)

# 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.0.tar.gz (2.3 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.0-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: optivor-1.2.0.tar.gz
  • Upload date:
  • Size: 2.3 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.0.tar.gz
Algorithm Hash digest
SHA256 2dd44af8de027858ccd8fec74832469628b330f5e29a397e0838b5e91aadcc55
MD5 0adcff8074d59bdb64d1a7187bc336bc
BLAKE2b-256 1a27b40739781eb0a789a9d895f4eb773176184167fb33d2a524693f46cfdf58

See more details on using hashes here.

File details

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

File metadata

  • Download URL: optivor-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cdd2816ebaa69ab50a9f7a6196c2d65c5e9131e78807c6dd0b62ffa3f8b63652
MD5 1283c36ae615b060fbe10f21f7be98ae
BLAKE2b-256 9e807e12d7f562eaf75b246f1247aead49fa57e1ac19d10956983553910d8878

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.3

2 files

1.2.1

2 files

This release

1.2.0 This release

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