API Reference¶
- class pychee.pychee.LycheeClient(url: str)¶
Lychee API Client.
The primary [Lychee API](https://lycheeorg.github.io/docs/api.html) client to interact with the specified Lychee server.
Methods
add_album
(title[, parent_id])Add a new Album with optional parent.
add_photo
(photo, photo_name, album_id)Upload a photo into an album.
change_login
(old_username, old_password[, ...])Change username or password.
Remove all photo's symlinks, if activated.
delete_album
(album_id)Delete the albums and all pictures in the album.
delete_photo
(photo_ids)Delete one or multiple photos.
delete_shares
(share_ids)Delete given shares.
duplicate_photos
(photo_ids, album_id)Duplicate one or multiple photos into an album.
get_album
(album_id)Get a Specific Album's Information.
Get List of Available Albums in Lychee.
get_albums_archive
(album_ids)Get a ZIP file of the pictures of the albums and their subalbums.
Get List of Available Album Data.
Get List of Album Trees in Lychee.
Get frame mode settings.
get_photo
(photo_id)Get information about a photo.
get_photos_archive
(photo_ids, kind)Get a photo or an archive of photos.
get_public_album
(album_id[, password])Get Public Album Information.
Get a random photo with current auth.
import_photo_from_url
(url, album_id)Import a photo from URL into an album.
login
(username, password)Log in to Lychee server.
logout
()Log out from Lychee server.
merge_albums
(dest_id, source_ids)Merge albums into one.
move_albums
(dest_id, source_ids)Move albums into another one, which becomes their parent.
set_album_description
(album_id, description)Change the description of the album.
set_album_license
(album_id, license)Set the license of an album.
set_album_public
(album_id, public, visible, ...)Change the sharing properties of the album.
set_albums_title
(album_ids, title)Change the title of the albums.
set_photo_description
(photo_id, description)Set the description of one or multiple photos.
set_photo_license
(photo_id, license)Set the license of a photo.
set_photo_public
(photo_id)Toggle the public status of a photo.
set_photos_album
(photo_ids, album_id)Put one or multiple photos into an album.
set_photos_star
(photo_ids)Toggle the favorite status of one or multiple photos.
set_photos_tags
(photo_ids, tags)Set tags for one or multiple photos.
set_photos_title
(photo_ids, title)Set the title of one or multiple photos.
share_with_users
(user_ids, album_ids)Share given albums with given users.
Get list of shared album.
shared_users
(album_ids)Get users with whom one or several albums are shared.
- add_album(title: str, parent_id: str | None = None) str ¶
Add a new Album with optional parent.
API won’t work with empty parent_id, use 0 as in webapp for no parent.
Return the ID of the new image.
- add_photo(photo: bytes, photo_name: str, album_id: str) str ¶
Upload a photo into an album.
photo should be open(‘/your/photo’, ‘rb’).read().
Return the ID of the uploaded image.
- change_login(old_username: str, old_password: str, new_username: str = '', new_password: str = '')¶
Change username or password.
If new_username of new_password is blank, it will stay the same.
- clear_photos_symlink()¶
Remove all photo’s symlinks, if activated.
Symlinks are disabled by default and allow to create expirable links to photos, preventing to guess the URL of the full sized photo.
See [the documentation](https://lycheeorg.github.io/docs/settings.html#symbolic-link).
- delete_album(album_id: List[str])¶
Delete the albums and all pictures in the album.
- delete_photo(photo_ids: List[str])¶
Delete one or multiple photos.
Delete given shares.
Share IDs can be found in the id field of the shared array when calling shared_albums().
- duplicate_photos(photo_ids: List[str], album_id: str)¶
Duplicate one or multiple photos into an album.
- get_album(album_id: str) dict ¶
Get a Specific Album’s Information.
Provided an albumID, returns the album.
- get_albums() dict ¶
Get List of Available Albums in Lychee.
Returns an array of albums or false on failure.
- get_albums_archive(album_ids: List[str]) bytes ¶
Get a ZIP file of the pictures of the albums and their subalbums.
Archive is returned as bytes, you can open a file with wb mode and write a file.
- get_albums_position_data() dict ¶
Get List of Available Album Data.
Returns the album with only map related data.
- get_albums_tree()¶
Get List of Album Trees in Lychee.
Returns a list of albums dictionaries or an informative message on failure.
- get_frame_settings() dict ¶
Get frame mode settings.
For now, the only setting returns the refresh time, in milliseconds.
- get_photo(photo_id) dict ¶
Get information about a photo.
- get_photos_archive(photo_ids: List[str], kind: str) bytes ¶
Get a photo or an archive of photos.
Kind is one of the following : FULL, LIVEPHOTOVIDEO, MEDIUM2X, MEDIUM, SMALL2X, SMALL, THUMB2X, THUMB.
If len(photo_ids) == 1, returns an image. Otherwise returns a ZIP archive.
Content is returned as bytes, you can open a file with wb mode and write a file.
- get_public_album(album_id: str, password: str = 'rand')¶
Get Public Album Information.
Provided the albumID and passwords, return whether the album can be accessed or not. The API won’t work if password if empty, even if no password.
- get_random_photo() bytes ¶
Get a random photo with current auth.
- import_photo_from_url(url: str, album_id: str)¶
Import a photo from URL into an album.
- login(username: str, password: str) None ¶
Log in to Lychee server.
- logout()¶
Log out from Lychee server.
- merge_albums(dest_id: str, source_ids: List[str])¶
Merge albums into one.
Seems that if destination album is one of the sources, it will be deleted. Don’t do this.
- move_albums(dest_id: str, source_ids: List[str])¶
Move albums into another one, which becomes their parent.
- set_album_description(album_id: str, description: str)¶
Change the description of the album.
- set_album_license(album_id: str, license: str)¶
Set the license of an album.
See https://github.com/LycheeOrg/Lychee/blob/master/app/Assets/Helpers.php for authorized licenses (search get_all_licenses())
Returns false if license name is unrecognized.
- set_album_public(album_id: str, public: int, visible: int, nsfw: int, downloadable: int, share_button_visible: int, full_photo: int, password: str = '')¶
Change the sharing properties of the album.
Contrary to getPublic API call, password can be empty (obv).
- set_albums_title(album_ids: List[str], title: str)¶
Change the title of the albums.
- set_photo_description(photo_id: str, description: str)¶
Set the description of one or multiple photos.
- set_photo_license(photo_id: str, license: str)¶
Set the license of a photo.
See https://github.com/LycheeOrg/Lychee/blob/master/app/Assets/Helpers.php for authorized licenses (search get_all_licenses())
Returns false if license name is unrecognized.
- set_photo_public(photo_id: str)¶
Toggle the public status of a photo.
A public photo will be unstarred, and vice versa.
- set_photos_album(photo_ids: List[str], album_id: str)¶
Put one or multiple photos into an album.
- set_photos_star(photo_ids: List[str])¶
Toggle the favorite status of one or multiple photos.
A starred photo will be unstarred, and vice versa.
- set_photos_tags(photo_ids: List[str], tags: List[str])¶
Set tags for one or multiple photos.
- set_photos_title(photo_ids: List[str], title: str)¶
Set the title of one or multiple photos.
Share given albums with given users.
Get list of shared album.
Get users with whom one or several albums are shared.