Skip to main content

Photoprism Python API Client

Project description

Photoprism Python API Client

Installation

pip install photoprism

Usage

import asyncio
from pathlib import Path

from photoprism import PhotoprismSession, PhotoprismClient
from photoprism.models.query import Size


async def main():
    session = PhotoprismSession(
        username="username",
        password="password",
        host="localhost",
        protocol="http",
    )
    client = PhotoprismClient(session)
    
    albums = await client.albums.filter(count=3, q="cats")
    for album in albums:
        image_path = await client.albums.download_cover_image(
            album_uid=album.uid,
            size=Size.Tile50,
            file_dir=Path("data/album_covers"),
        )
        print(image_path)

        
if __name__ == '__main__':
    asyncio.run(main())

Supported by

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