pychee: Client for Lychee, written in Python.¶
pychee¶
Client for Lychee, written in Python.
Lychee is a photo management system I’ve been using for years. I had the idea to make a « Lychee filesystem » with FUSE, so I needed an API client.
Installation¶
python3 -m pip install pychee
Notes¶
My reference is this documentation.
The API is partially implemented and focused on photo management, i.e. only
Albums
, Photo
, Frame
, Sharing
and Settings::setLogin
. Users can do
whatever they want with their albums and photos and change their password.
Disclaimer : I usually suck at coding, so use with caution and at your own risks. Tested with Lychee v4.7.0. The code probably won’t be retrocompatible and should just work with the latest version.
TODO¶
Add tests
Example usage¶
⚠️
pychee
returns exactly what the API sends back, just parsing it todict
if necessary. As sample answers are not documented in the API and because answers tend to change over time, you should inspect requests in browser if your client code does not works anymore.
A sample of common API calls :
#!/usr/bin/env python
# coding=utf-8
from pychee import pychee
# Initialize instance
client = pychee.LycheeClient('https://pic.chosto.me')
# Login
client.login('login', 'password')
# Create a new album
album_name = 'test_name'
album_id = client.add_album(album_name)['id']
# Add a photo in the created album
path_to_your_photo = '/your/path/photo.jpg'
with open(path_to_your_photo, 'rb') as f:
photo_id = client.add_photo(f, 'photo.jpg', album_id)['id']
# Set uploaded photo public
client.set_photo_public(photo_id)
# Set licence of uploaded photo
client.set_photo_license(photo_id, 'CC0')
# Download an archive of the created album
output_path = '/tmp/photos.zip'
with(open(output_path, 'wb')) as f:
f.write(client.get_albums_archive([album_id]))
# Logout
client.logout()
Documentation¶
Documentation is automatically published on GitHub: https://chostakovitch.github.io/pychee/index.html
API Documentation¶
Manually Install from GitHub as a Python Package¶
To install pychee
from GitHub:
Download the repository as a zipped package.
Unzip the repository.
Open a terminal (command-prompt) and navigate to the new folder that’s been unzipped.
Use
pip
orpython
to install with the following command :pip install .
Verify that it’s been installed by opening a Python instance and importing:
>>> import pychee
If no errors arise, the package has been installed.
Manually Install from GitHub as a Standalone File¶
If you wish to use pychee
as a standalone file in your Python project, you can
simply download the pychee.py
file from GitHub (you’ll want
this file
exactly) and save it wherever you need it! Then, just import pychee
and away
you go!
License¶
Contributing¶
Want to get involved? We’d love to have your help!
Please help us by identifying any issues that you come across. If you find an error, bug, or just have questions, jump over to the issue page.
If you want to add features, or contribute yourself, feel free to open a pull-request.
Source Repository¶
GitHub: https://github.com/Chostakovitch/pychee