Skip to main content

iiif ImageAPI for FastAPI

Project description

IIIF imageAPI for FastAPI

繝サInstall

pip install FastIIIFimageAPI

繝サInstantiation

from iafa import imageapi
processor = imageapi.imageAPI(
    version=2,
    pathPrefix='https://example.com/api/v1/image',
    opt = {
        "maxwidth"=10000
        "maxheight"=10000
    }
)

version(int): The version of imageAPI (2 or 3) pathPrefix(str): The prefix of your API's URI opt(Option?): maxwidth(int): Maximum image width your API can provide maxheight(int): Maximum image height your API can provide

繝サImage Requests

from fastapi import FastAPI

app = FastAPI()

@app.get('/api/v1/image/{imageIdentifier}/{req_path:path}')
async def returnImage(imageIdentifier: str, req_path: str):
    imagePath = IDtoPath(imageIdentifier) #arbitary function to find imagepath by imageIdentifier
    return processor.returnImage(imagePath, req_path)

繝サInfomation Requests

@app.get('/api/v1/image/{imageIdentifier}/info.json')
async def returnInfo(imageIdentifier: str):
    imagePath = IDtoPath(imageIdentifier) #arbitary function to find imagepath by imageIdentifier
    return processor.returnInfo(imagePath, imageIdentifier)

Warning: Always define Information Requests before Image Requests

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

FastIIIFimageAPI-0.0.1.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

FastIIIFimageAPI-0.0.1-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page