lanraragi_api.entity package

Submodules

lanraragi_api.entity.archive module

class lanraragi_api.entity.archive.ArchiveMetadata(*, arcid: str, extension: str, filename: str, isnew: bool | str | None = None, lastreadtime: int, pagecount: int, progress: int, size: int, summary: str | None = None, toc: list[dict[Any, Any]] | None = None, tags: str, title: str)

Bases: BaseModel

Metadata of a single Archive.

arcid

Unique identifier for the archive, a 40 character SHA1 hash.

Type:

str

extension

File extension of the archive.

Type:

str

filename

Filename of the archive.

Type:

str

isnew

Whether the archive is newly added. Defaults to None.

Type:

bool | str | None

lastreadtime

Unix timestamp of when the archive was last read.

Type:

int

pagecount

Total number of pages in the archive.

Type:

int

progress

Reading progress, as a page number.

Type:

int

size

Size of the archive in bytes.

Type:

int

summary

Summary description of the archive. Defaults to None.

Type:

str | None

toc

Table of contents for the archive, as objects holding the page where a chapter starts and its name. Defaults to None.

Type:

list[dict[Any, Any]] | None

tags

Comma-separated list of tags associated with the archive, with namespaced tags in namespace:value form.

Type:

str

title

Title of the archive.

Type:

str

arcid: str
extension: str
filename: str
isnew: bool | str | None
lastreadtime: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

pagecount: int
progress: int
size: int
summary: str | None
tags: str
title: str
toc: list[dict[Any, Any]] | None
class lanraragi_api.entity.archive.ArchiveTags(tags: str)

Bases: object

Offer utility methods to operate ArchiveMetadata.tags

append_artists(artists: list[str])

Add some new artists to the existing ones.

get_artists() → list[str]

Get all artists in a list from tags prefixed with artist:.

get_tag_list() → list[str]

Get a list of tags

set_artists(artists: list[str])

Set/Overwrite existing artists.

Consider using append_artists method if you want to add some new artists.

set_tag(tag_list: list[str])

Set the inner tags by a list of tags. Note that there will be a deduplication first.

property tags

Get the tags string represented by this class

lanraragi_api.entity.base module

class lanraragi_api.entity.base.Auth(value)

Bases: str, Enum

Way the API key is sent to the server.

QUERY_PARAM

Send the key as the key query parameter.

AUTH_HEADER

Send the key as a base64-encoded Authorization bearer header.

AUTH_HEADER = 'auth header'
QUERY_PARAM = 'query param'
class lanraragi_api.entity.base.DictLikeModel

Bases: BaseModel

Compatibility helper for endpoints that previously returned dict.

On top of the usual pydantic attribute access, models deriving from this class can be read like a dictionary, so callers written against the older dict based responses keep working.

get(key: str, default: None = None)

Return the value of the field named key, or a default.

Parameters:
  • key – Name of the field to read.

  • default – Value returned when the field does not exist. Defaults to None.

Returns:

The value of the requested field, or default.

items()

Return all fields of this model as name/value pairs.

Returns:

A view of (name, value) pairs.

keys()

Return the names of all fields of this model.

Returns:

A view of the field names.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class lanraragi_api.entity.base.OperationResponse(*, operation: str, error: str | None = None, successMessage: str | None = None, success: int, **extra_data: Any)

Bases: DictLikeModel

Result of an operation endpoint.

operation

Name of the operation.

Type:

str

error

Error message, if the operation failed.

Type:

str | None

successMessage

Success message, if the server sent one.

Type:

str | None

success

1 if the operation was successful, else 0.

Type:

int

error: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

operation: str
success: int
successMessage: str | None

lanraragi_api.entity.category module

class lanraragi_api.entity.category.CategoryMetadata(*, archives: list[str], id: str, name: str, pinned: int | str | None = None, search: str | None = None)

Bases: BaseModel

Metadata of a single Category.

archives

IDs of the archives of a static category, empty for a dynamic category.

Type:

list[str]

id

ID of the category.

Type:

str

name

Name of the category.

Type:

str

pinned

Whether this category should be pinned in the UI.

Type:

int | str | None

search

Search filter of a dynamic category, empty for a static category.

Type:

str | None

archives: list[str]
id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
pinned: int | str | None
search: str | None

lanraragi_api.entity.database module

class lanraragi_api.entity.database.BackupArchiveMetadata(*, arcid: str, title: str, tags: str | None = None, summary: str | None = None, thumbhash: str | None = None, filename: str)

Bases: DictLikeModel

Archive metadata as returned in a database backup.

arcid

Unique identifier for the archive.

Type:

str

title

Title of the archive.

Type:

str

tags

Comma-separated list of tags associated with the archive.

Type:

str | None

summary

Summary description of the archive.

Type:

str | None

thumbhash

Thumbnail hash, or null if not set.

Type:

str | None

filename

Filename of the archive.

Type:

str

arcid: str
filename: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

summary: str | None
tags: str | None
thumbhash: str | None
title: str
class lanraragi_api.entity.database.BackupCategoryMetadata(*, archives: list[str] = <factory>, catid: str, name: str | None = None, search: str | None = None)

Bases: DictLikeModel

Category metadata as returned in a database backup.

archives

Array of archive IDs.

Type:

list[str]

catid

ID of the category.

Type:

str

name

Name of the category.

Type:

str | None

search

Category search filter.

Type:

str | None

archives: list[str]
catid: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
search: str | None
class lanraragi_api.entity.database.BackupTankoubonMetadataJson(*, tankid: str, name: str | None = None, summary: str | None = None, tags: str | None = None, archives: list[str] = <factory>)

Bases: DictLikeModel

Tankoubon metadata as returned in a database backup.

tankid

ID of the tankoubon.

Type:

str

name

Name of the tankoubon.

Type:

str | None

summary

Summary of the tankoubon.

Type:

str | None

tags

Tags associated with the tankoubon.

Type:

str | None

archives

Array of archive IDs.

Type:

list[str]

archives: list[str]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
summary: str | None
tags: str | None
tankid: str
class lanraragi_api.entity.database.DatabaseBackup(*, archives: list[~lanraragi_api.entity.database.BackupArchiveMetadata] = <factory>, categories: list[~lanraragi_api.entity.database.BackupCategoryMetadata] = <factory>, tankoubons: list[~lanraragi_api.entity.database.BackupTankoubonMetadataJson] = <factory>)

Bases: DictLikeModel

Full backup of the database in JSON form.

archives

Array of archive metadata.

Type:

list[lanraragi_api.entity.database.BackupArchiveMetadata]

categories

Array of category metadata.

Type:

list[lanraragi_api.entity.database.BackupCategoryMetadata]

tankoubons

Array of tankoubon metadata.

Type:

list[lanraragi_api.entity.database.BackupTankoubonMetadataJson]

archives: list[BackupArchiveMetadata]
categories: list[BackupCategoryMetadata]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tankoubons: list[BackupTankoubonMetadataJson]
class lanraragi_api.entity.database.TagStatistic(*, namespace: str | None = None, text: str, weight: int)

Bases: BaseModel

Prevalence of a single tag in the database.

namespace

Namespace of the tag, if it has one.

Type:

str | None

text

The tag itself.

Type:

str

weight

Weight of the tag in the database.

Type:

int

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

namespace: str | None
text: str
weight: int

lanraragi_api.entity.minion module

class lanraragi_api.entity.minion.BasicJobStatus(*, state: str, task: str, error: str | None = None, notes: dict[Any, Any] | None = None)

Bases: BaseModel

Basic status of a Minion job.

state

State of the job, one of inactive, active, finished or failed.

Type:

str

task

Name of the task the job runs.

Type:

str

error

Error message of the job, if any.

Type:

str | None

notes

Arbitrary data attached to the job.

Type:

dict[Any, Any] | None

error: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

notes: dict[Any, Any] | None
state: str
task: str
class lanraragi_api.entity.minion.FullJobStatus(*, args: list[~typing.Any] = <factory>, attempts: str, children: list[~typing.Any] = <factory>, created: str, delayed: str, expires: str | None = None, finished: str | None = None, id: str, lax: int = 0, notes: dict[~typing.Any, ~typing.Any] = <factory>, parents: list[~typing.Any] = <factory>, priority: str, queue: str, result: dict[~typing.Any, ~typing.Any] | None = None, retried: ~typing.Any | None = None, retries: str, started: str, state: str, task: str, worker: int)

Bases: BaseModel

Detailed status of a Minion job.

args

Arguments the job was queued with.

Type:

list[Any]

attempts

Number of attempts made to run the job.

Type:

str

children

IDs of child jobs attached to the job.

Type:

list[Any]

created

Timestamp when the job was created.

Type:

str

delayed

Timestamp until which the job is delayed.

Type:

str

expires

Timestamp when the job expires, if it was given one.

Type:

str | None

finished

Timestamp when the job finished.

Type:

str | None

id

ID of the job.

Type:

str

lax

Whether the job runs in lax mode.

Type:

int

notes

Arbitrary data attached to the job.

Type:

dict[Any, Any]

parents

IDs of parent jobs attached to the job.

Type:

list[Any]

priority

Priority of the job.

Type:

str

queue

Queue the job belongs to.

Type:

str

result

Result data of the job, if it produced any.

Type:

dict[Any, Any] | None

retried

Information about the retry of the job, if it was retried.

Type:

Any | None

retries

Number of retries allowed for the job.

Type:

str

started

Timestamp when the job started.

Type:

str

state

State of the job.

Type:

str

task

Name of the task the job runs.

Type:

str

worker

ID of the worker that ran the job.

Type:

int

args: list[Any]
attempts: str
children: list[Any]
created: str
delayed: str
expires: str | None
finished: str | None
id: str
lax: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

notes: dict[Any, Any]
parents: list[Any]
priority: str
queue: str
result: dict[Any, Any] | None
retried: Any | None
retries: str
started: str
state: str
task: str
worker: int
class lanraragi_api.entity.minion.MinionJobResponse(*, operation: str, error: str | None = None, successMessage: str | None = None, success: int, job: int | None = None, **extra_data: Any)

Bases: OperationResponse

Result of an operation that queued a Minion job.

job

ID of the queued Minion job, if one was queued.

Type:

int | None

job: int | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

lanraragi_api.entity.misc module

class lanraragi_api.entity.misc.DownloadUrlResponse(*, operation: str, error: str | None = None, successMessage: str | None = None, success: int, job: int | None = None, url: str | None = None, category: str | None = None, **extra_data: Any)

Bases: MinionJobResponse

Result of an operation that queued a URL download.

url

URL queued for download.

Type:

str | None

category

Category the download was added to, if one was given.

Type:

str | None

category: str | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

url: str | None
class lanraragi_api.entity.misc.ServerInfo(*, archives_per_page: int, cache_last_cleared: int, debug_mode: bool, has_password: bool, motd: str, name: str, nofun_mode: bool, server_resizes_images: bool, server_tracks_progress: bool, authenticated_progress: bool | None = None, total_archives: int, total_pages_read: int, version: str, version_desc: str, version_name: str, excluded_namespaces: list[str] = <factory>)

Bases: BaseModel

Server info payload emitted by /api/info.

Older server versions used integers instead of booleans here.

archives_per_page

How many archives per page the server lists.

Type:

int

cache_last_cleared

Timestamp for last time the search cache was wiped.

Type:

int

debug_mode

Whether the instance has debug mode enabled.

Type:

bool

has_password

Whether the instance is password-protected.

Type:

bool

motd

MOTD of the instance.

Type:

str

name

Name of the instance.

Type:

str

nofun_mode

Whether the instance has no-fun mode enabled.

Type:

bool

server_resizes_images

Whether the instance auto-downsizes images before serving them.

Type:

bool

server_tracks_progress

Whether the instance tracks reading progression server-side.

Type:

bool

authenticated_progress

Whether the instance requires authentication for server-side progress updates.

Type:

bool | None

total_archives

Total amount of archives stored on instance.

Type:

int

total_pages_read

Total amount of pages read.

Type:

int

version

Version of the server.

Type:

str

version_desc

Version description.

Type:

str

version_name

Version name.

Type:

str

excluded_namespaces

Tag namespaces excluded from search suggestions and tag statistics.

Type:

list[str]

archives_per_page: int
authenticated_progress: bool | None
cache_last_cleared: int
debug_mode: bool
excluded_namespaces: list[str]
has_password: bool
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

motd: str
name: str
nofun_mode: bool
server_resizes_images: bool
server_tracks_progress: bool
total_archives: int
total_pages_read: int
version: str
version_desc: str
version_name: str
class lanraragi_api.entity.misc.TempfolderCleanupResponse(*, operation: str, error: str | None = None, successMessage: str | None = None, success: int, newsize: int | None = None, **extra_data: Any)

Bases: OperationResponse

Result of a temporary folder cleanup.

newsize

Current size of the temporary folder post-cleanup.

Type:

int | None

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

newsize: int | None

lanraragi_api.entity.plugin module

class lanraragi_api.entity.plugin.PluginInfo(*, author: str | None = None, description: str | None = None, name: str | None = None, icon: str | None = None, type: str | None = None, namespace: str | None = None, parameters: list[~lanraragi_api.entity.plugin.PluginParameter] = <factory>, version: str | None = None, oneshot_arg: str | None = None, url_regex: str | None = None, login_from: str | None = None)

Bases: DictLikeModel

Metadata payload for a LRR Plugin.

author

Author of the plugin.

Type:

str | None

description

Description of the plugin.

Type:

str | None

name

Name of the plugin.

Type:

str | None

icon

Base64 image of the plugin icon.

Type:

str | None

type

Type of the plugin, one of download, login, metadata or script.

Type:

str | None

namespace

Unique namespace for the plugin.

Type:

str | None

parameters

Parameters the plugin accepts.

Type:

list[lanraragi_api.entity.plugin.PluginParameter]

version

Version of the plugin.

Type:

str | None

oneshot_arg

Description of the manual one-shot argument users can fill in for manual plugin calls.

Type:

str | None

url_regex

For downloader plugins, regex where it should be used.

Type:

str | None

login_from

Namespace of the login plugin this plugin depends on.

Type:

str | None

author: str | None
description: str | None
icon: str | None
login_from: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
namespace: str | None
oneshot_arg: str | None
parameters: list[PluginParameter]
type: str | None
url_regex: str | None
version: str | None
class lanraragi_api.entity.plugin.PluginParameter(*, name: str | None = None, desc: str | None = None, type: str | None = None, default_value: str | None = None)

Bases: DictLikeModel

Parameter for a LRR Plugin.

name

Name of the parameter.

Type:

str | None

desc

Description of the parameter.

Type:

str | None

type

Type of the parameter, one of bool, int or string. Not checked server-side; used to inform the plugin config page.

Type:

str | None

default_value

Default value of the parameter.

Type:

str | None

default_value: str | None
desc: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str | None
type: str | None
class lanraragi_api.entity.plugin.PluginUseResponse(*, operation: str, error: str | None = None, successMessage: str | None = None, success: int, type: str | None = None, data: dict[str, Any] | None = None, **extra_data: Any)

Bases: OperationResponse

Result of a Plugin run.

type

Type of the plugin that ran, one of download, login, metadata or script. Omitted when the plugin is not found.

Type:

str | None

data

Arbitrary data returned by the plugin.

Type:

dict[str, Any] | None

data: dict[str, Any] | None
model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type: str | None

lanraragi_api.entity.search module

class lanraragi_api.entity.search.SearchIdsResult(*, data: list[str], recordsFiltered: int | None = None, recordsTotal: int | None = None)

Bases: BaseModel

Result of a search returning only archive IDs.

data

Archive IDs for each search result.

Type:

list[str]

recordsFiltered

Amount of archives in the search result. Defaults to None.

Type:

int | None

recordsTotal

Total number of archives available. This result changes depending on the groupby_tanks parameter. Defaults to None.

Type:

int | None

data: list[str]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

recordsFiltered: int | None
recordsTotal: int | None
class lanraragi_api.entity.search.SearchResult(*, data: list[ArchiveMetadata], draw: int | None = None, recordsFiltered: int | None = None, recordsTotal: int | None = None)

Bases: BaseModel

Result of a search returning archive metadata.

data

Archive metadata objects for each search result.

Type:

list[lanraragi_api.entity.archive.ArchiveMetadata]

draw

Draw counter sent back by the server for paged searches, if any. Defaults to None.

Type:

int | None

recordsFiltered

Amount of archives in the search result. Defaults to None.

Type:

int | None

recordsTotal

Total number of archives available. This result changes depending on the groupby_tanks parameter. Defaults to None.

Type:

int | None

data: list[ArchiveMetadata]
draw: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

recordsFiltered: int | None
recordsTotal: int | None

lanraragi_api.entity.stamp module

class lanraragi_api.entity.stamp.AddStampResponse(*, operation: str, error: str | None = None, successMessage: str | None = None, success: int, stamp_id: str | None = None, **extra_data: Any)

Bases: OperationResponse

Result of the operation that adds a stamp to a page.

stamp_id

ID of the created stamp.

Type:

str | None

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

stamp_id: str | None
class lanraragi_api.entity.stamp.StampsData(*, id: str | None = None, position: str, content: str)

Bases: BaseModel

JSON object for the Stamp model.

id

ID of the stamp.

Type:

str | None

position

Position of the stamp in the page in normalized coordinates (0-100).

Type:

str

content

Text of the stamp.

Type:

str

content: str
id: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

position: str
class lanraragi_api.entity.stamp.StampsResponse(*, result: list[str] = <factory>)

Bases: DictLikeModel

Response listing the pages that contain at least one stamp.

result

Page indices of the archive that contain a stamp.

Type:

list[str]

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

result: list[str]

lanraragi_api.entity.tankoubon module

class lanraragi_api.entity.tankoubon.TankoubonDetailResponse(*, result: TankoubonMetadata, total: int | None = None, filtered: int | None = None)

Bases: DictLikeModel

Tankoubon returned by the full detail endpoint.

result

Tankoubon metadata, with full_data filled in.

Type:

lanraragi_api.entity.tankoubon.TankoubonMetadata

total

Total amount of archives in this Tankoubon.

Type:

int | None

filtered

Amount of archives in the current page.

Type:

int | None

filtered: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

result: TankoubonMetadata
total: int | None
class lanraragi_api.entity.tankoubon.TankoubonListResponse(*, result: list[~lanraragi_api.entity.tankoubon.TankoubonMetadata] = <factory>, total: int | None = None, filtered: int | None = None)

Bases: DictLikeModel

Paginated list of Tankoubons returned by the list endpoint.

result

Tankoubons of the current page.

Type:

list[lanraragi_api.entity.tankoubon.TankoubonMetadata]

total

Total count of Tankoubons on the server.

Type:

int | None

filtered

Number of Tankoubons on the current page.

Type:

int | None

filtered: int | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

result: list[TankoubonMetadata]
total: int | None
class lanraragi_api.entity.tankoubon.TankoubonMetadata(*, archives: list[str], full_data: list[ArchiveMetadata] | None = None, tankid: str, name: str, summary: str | None = None, tags: str | None = None, progress: int | None = None)

Bases: BaseModel

Metadata of a single Tankoubon.

Tankoubon metadata as returned by the list endpoint, with the archive IDs it contains and optional full archive metadata.

archives

Array of archive IDs contained in this Tankoubon.

Type:

list[str]

full_data

Archive metadata of the archives, filled by the full detail endpoint only.

Type:

list[lanraragi_api.entity.archive.ArchiveMetadata] | None

tankid

ID of the tankoubon.

Type:

str

name

Name of the tankoubon.

Type:

str

summary

Summary of the tankoubon.

Type:

str | None

tags

Tags associated with the tankoubon.

Type:

str | None

progress

Reading progress (page number) for this Tankoubon.

Type:

int | None

archives: list[str]
full_data: list[ArchiveMetadata] | None
property id: str

Return the ID of the tankoubon.

This is a backward-compatible alias for the tankid field.

Returns:

ID of the tankoubon.

Return type:

str

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
progress: int | None
summary: str | None
tags: str | None
tankid: str

Module contents