API reference¶
Auto-generated reference for every public symbol in the Nyora library
(import nyora). Each section renders the live docstrings of a module. For
narrative usage, see the library guide.
Package overview¶
The top-level nyora package re-exports the cloud client, the async client, the
cloud-sync client, the model dataclasses, and the exception hierarchy. Each
re-exported symbol is documented in full under its canonical module section
below.
Nyora Python SDK — the importable nyora library.
Nyora is a manga sources SDK. The default client (nyora.Nyora) is a
thin client over the Nyora cloud helper (https://api.hasanraza.tech — the
kotatsu-parsers engine, ~960 sources): it runs no parsers in-process, speaking
the helper’s REST contract over httpx. nyora.sync.NyoraSync adds
account and library sync against the Nyora cloud
(https://stream.hasanraza.tech).
This module is the public surface of the SDK. It re-exports the primary client
(and the async nyora.AsyncNyora), the cloud sync client, the typed
nyora.models dataclasses, and the SDK exception hierarchy.
The importable nyora library and the separately shipped nyora-cli tool
(which launches the terminal UI) are distinct: this package documents the SDK.
Example
>>> import nyora
>>> with nyora.Nyora() as client:
... source = client.sources.find("mangadex")
... page = client.manga.popular(source.id)
... first = page.entries[0]
... details = client.manga.details(source.id, first.url, title=first.title)
nyora.client¶
The cloud clients (Nyora, AsyncNyora) and the CLOUD_BASE_URL default.
Nyora helper HTTP clients.
This module provides the cloud-backed REST clients. They run no parsers
themselves; they speak the camelCase helper REST contract over HTTP via
httpx against the Nyora cloud helper.
It exposes:
Nyora— synchronous client with the full set of service objects (sources, manga, library, downloads, backup, system).AsyncNyora— lightweight async client for read-style requests.
The base URL defaults to the public Nyora cloud (https://api.hasanraza.tech);
it can be overridden with an explicit argument, the NYORA_BASE_URL
environment variable, or a local helper’s port file. A self-hosted helper jar
can also be launched and managed via Nyora.managed().
- nyora.client.CLOUD_BASE_URL = 'https://api.hasanraza.tech'¶
Public Nyora cloud helper. Used by default so a bare
Nyora()works with no local helper — the SDK is a thin cloud client.
- class nyora.client.Nyora(base_url=None, *, timeout=60.0, helper=None)[source]¶
Bases:
objectSynchronous Nyora SDK client backed by a helper REST API.
Wraps an
httpx.Clientagainst a discovered or managed helper and exposes the full set of service objects. Use as a context manager to release the HTTP connection (and stop a managed helper) on exit.- Variables:
base_url – The resolved helper base URL.
sources –
SourcesService.manga –
MangaService.library –
LibraryService.downloads –
DownloadsService.backup –
BackupService.system –
SystemService.
Example
>>> with Nyora.attach() as client: ... for source in client.sources.list(): ... print(source.id, source.name)
Connect to a helper and construct the service objects.
- Parameters:
- Raises:
HelperNotFoundError – If no helper can be discovered.
- classmethod managed(jar_path=None, *, java='java', timeout=60.0, launch_timeout=20.0)[source]¶
Launch a helper jar and return a client bound to it.
The launched process is owned by the returned client and is stopped on
close().- Parameters:
jar_path (
str|PathLike[str] |None) – Path to the helper jar. WhenNoneit is read from theNYORA_HELPER_JARenvironment variable.java (
str) – Thejavaexecutable to invoke.timeout (
float) – Per-request HTTP timeout in seconds for the client.launch_timeout (
float) – Seconds to wait for the helper to report healthy.
- Return type:
Self- Returns:
A client connected to the managed helper.
- Raises:
HelperNotFoundError – If the jar path is missing or does not exist.
HelperLaunchError – If the helper fails to start within the timeout.
- post(path, *, params=None, json=None, content=None)[source]¶
Issue a
POSTrequest against the helper.- Parameters:
- Return type:
- Returns:
Parsed JSON, or the response text for non-JSON bodies.
- Raises:
NyoraHTTPError – If the helper returns a 4xx/5xx response.
- class nyora.client.AsyncNyora(base_url=None, *, timeout=60.0)[source]¶
Bases:
objectAsynchronous Nyora helper client for read-style requests.
A lightweight
httpx.AsyncClientwrapper exposingget()against a discovered or explicit helper base URL. Use as an async context manager to release the connection on exit.- Variables:
base_url – The resolved helper base URL.
Example
>>> async with AsyncNyora.attach() as client: ... payload = await client.get("/sources")
Connect to a helper.
- Parameters:
- Raises:
HelperNotFoundError – If no helper can be discovered.
- classmethod attach(base_url=None, *, timeout=60.0)[source]¶
Attach to an already-running helper.
- Parameters:
- Return type:
- Returns:
A connected async client.
nyora.sync¶
Cloud account and library sync (NyoraSync) against the Nyora sync server.
Nyora cloud sync — account + library sync against the self-hosted sync server.
NyoraSync talks to the Nyora sync server (https://stream.hasanraza.tech)
using an OAuth2 password flow + JWT, then a generic last-write-wins upsert/select
over the per-user tables (nyora_manga, nyora_favourite, tracking, …). It
mirrors the iOS NyoraSyncClient and replaces the old Supabase-based sync.
Tokens are held in memory and, when a token_path is given, persisted to disk
so a process can stay signed in across runs.
- class nyora.sync.NyoraSync(base_url=None, *, timeout=30.0, token_path=None)[source]¶
Bases:
objectAccount and library sync against the Nyora sync server.
Example
>>> sync = NyoraSync() >>> sync.sign_in("me@example.com", "hunter2") >>> sync.upsert("nyora_manga", [{"key": "...", "source": "...", "title": "..."}]) >>> rows = sync.select("nyora_manga")
Create a sync client.
- Parameters:
base_url (
str|None) – Sync server base URL. Defaults tohttps://stream.hasanraza.tech(or theNYORA_SYNC_URLenv var).timeout (
float) – Per-request HTTP timeout in seconds.token_path (
str|PathLike[str] |None) – Where to persist tokens.Noneuses the default user config path; passFalse-y string to disable persistence.
- select(table, since=None)[source]¶
Fetch rows from
table, optionally only those changed aftersince.
- exception nyora.sync.NotSignedInError[source]¶
Bases:
RuntimeErrorRaised when a sync operation is attempted without signing in.
nyora.models¶
Typed dataclasses returned throughout the SDK.
Typed data models for the Nyora SDK.
Lightweight, slotted dataclasses that mirror the JSON returned by the Nyora
cloud helper REST API. Every model exposes a tolerant from_json classmethod
that accepts the raw camelCase payloads and coerces field types defensively, so
missing or malformed fields fall back to sensible defaults rather than raising.
These types are returned throughout nyora.Nyora and the service
objects.
- class nyora.models.MangaPage(url, headers=<factory>)[source]¶
Bases:
objectA single readable image page of a chapter.
- Variables:
url – The image URL.
headers – Request headers required to fetch the image (e.g.
Referer).
- Parameters:
- class nyora.models.MangaChapter(id, title, number=0.0, volume=0, url='', scanlator=None, upload_date=0, branch=None, pages=<factory>, index=0)[source]¶
Bases:
objectA chapter belonging to a manga.
- Variables:
id – Stable chapter identifier.
title – Display title.
number – Chapter number (may be fractional).
volume – Volume number, or
0if unknown.url – Source-relative or absolute chapter URL.
scanlator – Scanlation group, if known.
upload_date – Upload timestamp in epoch milliseconds.
branch – Scanlation branch/translation name, if any.
pages – Resolved pages, when already loaded.
index – Position within the chapter list.
- Parameters:
- classmethod from_json(data)[source]¶
Build a
MangaChapterfrom a raw payload.- Parameters:
data (
Any) – A chapter object from the parser or helper.- Return type:
- Returns:
The parsed chapter.
- class nyora.models.Manga(id, title, alt_titles=<factory>, url='', public_url='', rating=-1.0, is_nsfw=False, content_rating=None, cover_url='', large_cover_url=None, state=None, authors=<factory>, source=<factory>, source_id='', description='', tags=<factory>, chapters=<factory>, unread=0, progress=0.0)[source]¶
Bases:
objectA manga entry as returned in listings and details.
- Variables:
id – Stable manga identifier.
title – Primary title.
alt_titles – Alternative titles.
url – Source-relative or absolute manga URL.
public_url – Public web URL for the manga, if distinct.
rating – Normalized rating, or
-1.0when unknown.is_nsfw – Whether the entry is flagged adult/NSFW.
content_rating – Source-provided content rating, if any.
cover_url – Cover thumbnail URL.
large_cover_url – High-resolution cover URL, if available.
state – Publication state (e.g. ongoing/finished), if known.
authors – Author names.
source – Raw source metadata as a dict.
source_id – Identifier of the owning source.
description – Synopsis text.
tags – Genre/tag dicts.
chapters – Chapters, when already loaded.
unread – Unread chapter count, for library entries.
progress – Read progress fraction, for library entries.
- Parameters:
- chapters: list[MangaChapter]¶
- class nyora.models.Source(id, name, lang='', base_url='', engine='', content_type='', is_installed=False, is_pinned=False, is_nsfw=False, is_obsolete=False, icon_url='', version='', notes='', can_uninstall=True)[source]¶
Bases:
objectA content source (site) the SDK can read from.
- Variables:
id – Stable source identifier.
name – Human-readable source name.
lang – Primary content language/locale code.
base_url – The source’s base site URL.
engine – Parser engine (e.g.
"JavaScript").content_type – Content type (e.g.
"Manga").is_installed – Whether the source is installed/available.
is_pinned – Whether the user pinned the source.
is_nsfw – Whether the source is flagged adult/NSFW.
is_obsolete – Whether the source is deprecated.
icon_url – Source icon URL.
version – Source/parser version string.
notes – Free-form notes.
can_uninstall – Whether the source may be uninstalled.
- Parameters:
- class nyora.models.SourceFilter(name, type_name, values=<factory>)[source]¶
Bases:
objectA search filter advertised by a source.
- Variables:
name – Filter name.
type_name – Filter widget/type (e.g. select, toggle).
values – Allowed values for the filter.
- Parameters:
- classmethod from_json(data)[source]¶
Build a
SourceFilterfrom a raw payload.- Parameters:
data (
Any) – A filter object from the helper.- Return type:
- Returns:
The parsed filter.
- class nyora.models.SearchPage(entries, has_next_page=False)[source]¶
Bases:
objectOne page of manga results from browse or search.
- Variables:
entries – The manga on this page.
has_next_page – Whether a further page is likely available.
- Parameters:
- classmethod from_json(data)[source]¶
Build a
SearchPagefrom a raw payload.- Parameters:
data (
Any) – A page object withentriesandhasNextPage.- Return type:
- Returns:
The parsed page.
- class nyora.models.MangaDetails(manga, chapters)[source]¶
Bases:
objectFull metadata for one manga together with its chapter list.
- Variables:
manga – The manga metadata.
chapters – The manga’s chapters.
- Parameters:
manga (
Manga)chapters (
list[MangaChapter])
- chapters: list[MangaChapter]¶
- classmethod from_json(data)[source]¶
Build a
MangaDetailsfrom a raw payload.- Parameters:
data (
Any) – An object withmangaandchapters.- Return type:
- Returns:
The parsed details.
- reading_order()[source]¶
Return the chapters in canonical reading order (earliest first).
Sources order their chapter arrays inconsistently (ascending on some, descending on others); this normalises them so index
0is always the earliest chapter.- Return type:
- next_chapter(current)[source]¶
Return the next (later) chapter after
current, order-independent.- Parameters:
current (
MangaChapter)- Return type:
- previous_chapter(current)[source]¶
Return the previous (earlier) chapter before
current, order-independent.- Parameters:
current (
MangaChapter)- Return type:
- class nyora.models.HistoryEntry(manga, chapter_id='', page=0, percent=0.0, updated_at=0)[source]¶
Bases:
objectA reading-history record for a manga.
- Variables:
manga – The manga that was read.
chapter_id – The last-read chapter identifier.
page – The last-read page index.
percent – Read progress fraction within the chapter.
updated_at – Last-update timestamp in epoch milliseconds.
- Parameters:
- classmethod from_json(data)[source]¶
Build a
HistoryEntryfrom a raw payload.- Parameters:
data (
Any) – A history object from the helper.- Return type:
- Returns:
The parsed entry.
- class nyora.models.Category(id, title, manga_count=0)[source]¶
Bases:
objectA user-defined library category.
- Variables:
id – Category identifier.
title – Display title.
manga_count – Number of manga in the category.
- Parameters:
- class nyora.models.Download(id, source_id, manga_title, chapter_title, chapter_url, status, total_pages=0, completed_pages=0, failed_pages=0, file_path=None, error=None)[source]¶
Bases:
objectA chapter download task and its progress.
- Variables:
id – Download task identifier.
source_id – Identifier of the owning source.
manga_title – Title of the manga being downloaded.
chapter_title – Title of the chapter being downloaded.
chapter_url – URL of the chapter being downloaded.
status – Task status string.
total_pages – Total number of pages to download.
completed_pages – Pages downloaded so far.
failed_pages – Pages that failed to download.
file_path – Output path once complete, if available.
error – Error message when the task failed, if any.
- Parameters:
- class nyora.models.DownloadSettings(max_concurrent_downloads=3, format='AUTO')[source]¶
Bases:
objectDownload subsystem settings.
- Variables:
max_concurrent_downloads – Maximum simultaneous downloads.
format – Output format (e.g.
"AUTO").
- Parameters:
- classmethod from_json(data)[source]¶
Build
DownloadSettingsfrom a raw payload.Accepts either a bare settings object or one nested under
settings.- Parameters:
data (
Any) – A settings object from the helper.- Return type:
- Returns:
The parsed settings.
- class nyora.models.MangaPrefs(manga_id, reader_mode='', brightness=0.0, contrast=1.0, saturation=1.0, hue=0.0, palette='', present=False)[source]¶
Bases:
objectPer-manga reader preferences.
- Variables:
manga_id – Identifier of the manga these preferences apply to.
reader_mode – Reader layout/mode.
brightness – Brightness adjustment.
contrast – Contrast multiplier.
saturation – Saturation multiplier.
hue – Hue rotation.
palette – Named color palette.
present – Whether stored preferences exist for this manga.
- Parameters:
- classmethod from_json(data)[source]¶
Build
MangaPrefsfrom a raw payload.- Parameters:
data (
Any) – A preferences object from the helper.- Return type:
- Returns:
The parsed preferences.
- class nyora.models.GlobalSearchGroup(source_id, source_name, entries, error=None)[source]¶
Bases:
objectResults from one source within a cross-source global search.
- Variables:
source_id – Identifier of the source that produced these results.
source_name – Display name of the source.
entries – Matching manga from this source.
error – Error message if this source’s search failed, else
None.
- Parameters:
- classmethod from_json(data)[source]¶
Build a
GlobalSearchGroupfrom a raw payload.- Parameters:
data (
Any) – A group object from the helper.- Return type:
- Returns:
The parsed group.
- class nyora.models.Stats(total_chapters=0, distinct_manga=0, favourites_count=0, longest_streak_days=0, top_sources=<factory>)[source]¶
Bases:
objectAggregate reading statistics.
- Variables:
total_chapters – Total chapters read.
distinct_manga – Number of distinct manga read.
favourites_count – Number of favourited manga.
longest_streak_days – Longest consecutive reading streak in days.
top_sources – Per-source usage breakdown dicts.
- Parameters:
- class nyora.models.BackupImportResult(ok, imported_favourites=0, imported_history=0)[source]¶
Bases:
objectOutcome of importing a backup archive.
- Variables:
ok – Whether the import succeeded.
imported_favourites – Number of favourites imported.
imported_history – Number of history records imported.
- Parameters:
- classmethod from_json(data)[source]¶
Build a
BackupImportResultfrom a raw payload.- Parameters:
data (
Any) – A result object from the helper.- Return type:
- Returns:
The parsed result.
nyora.errors¶
The SDK exception hierarchy.
Nyora SDK exceptions.
Defines the exception hierarchy raised across the SDK. NyoraError is
the common base; helper discovery, helper launch, and helper HTTP failures each
have a dedicated subclass so callers can catch them selectively.
- exception nyora.errors.HelperNotFoundError[source]¶
Bases:
NyoraErrorRaised when no running helper can be discovered.
- exception nyora.errors.HelperLaunchError[source]¶
Bases:
NyoraErrorRaised when a managed helper process fails to start.
- exception nyora.errors.NyoraHTTPError(status_code, message, *, body='')[source]¶
Bases:
NyoraErrorRaised when the helper returns a non-successful HTTP response.
- Variables:
status_code – The HTTP status code returned by the helper.
body – The raw response body, when available.
- Parameters:
Initialize the error.
nyora.config¶
Endpoint-discovery configuration: environment variables and the port file.
Configuration helpers for local Nyora helper discovery.
Defines the environment-variable names the SDK honors and resolves the
platform-specific path of the helper port file. These helpers let
nyora.client and nyora.helper locate a running Nyora helper
without explicit configuration.
- Environment variables:
NYORA_BASE_URL: Explicit helper base URL, overriding port-file discovery. NYORA_HELPER_PORT_FILE: Override path for the helper port file. NYORA_HELPER_JAR: Path to a helper jar for managed launches.
- nyora.config.default_port_file()[source]¶
Return the path of the helper port file for this platform.
Honors
NYORA_HELPER_PORT_FILEwhen set; otherwise uses the platform-conventional application-data location (macOS Application Support, Windows%APPDATA%, or the XDG config dir on Linux).- Return type:
- Returns:
The resolved port-file path (which may not yet exist).
- nyora.config.read_base_url_from_port_file(port_file=None)[source]¶
Derive a helper base URL from a port file, if present.
- Parameters:
port_file (
Path|None) – Path to read. Defaults todefault_port_file().- Return type:
- Returns:
http://127.0.0.1:<port>when the file exists and holds a port, elseNone.
Services¶
The service objects attached to the client (nyora.client.Nyora).
nyora.services.sources¶
Source catalog operations.
- class nyora.services.sources.SourcesService(client)[source]¶
Bases:
objectBrowse, manage, and inspect the helper’s content sources.
Attached to a client as
client.sources.- Parameters:
client (
Nyora)
Bind the service to a helper client.
- Parameters:
client (
Nyora) – The owningnyora.client.Nyorainstance.
- filters(source_id)[source]¶
List the search filters a source advertises.
- Parameters:
source_id (
str) – Identifier of the source to query.- Return type:
- Returns:
The source’s
SourceFilterdefinitions.
nyora.services.manga¶
Manga browse, search, reader, and metadata operations.
- class nyora.services.manga.MangaService(client)[source]¶
Bases:
objectBrowse, search, read, and configure manga via the helper.
Attached to a client as
client.manga.- Parameters:
client (
Nyora)
Bind the service to a helper client.
- Parameters:
client (
Nyora) – The owningnyora.client.Nyorainstance.
- popular(source_id, page=1)[source]¶
Fetch a page of popular manga from a source.
- Parameters:
- Return type:
- Returns:
A
SearchPageof entries.
- latest(source_id, page=1)[source]¶
Fetch a page of the latest updated manga from a source.
- Parameters:
- Return type:
- Returns:
A
SearchPageof entries.
- search(source_id, query, page=1, *, filters=None)[source]¶
Search a source for manga matching a query.
- Parameters:
- Return type:
- Returns:
A
SearchPageof matching entries.
- global_search(query, *, limit_per_source=8)[source]¶
Search every installed source at once.
- Parameters:
- Return type:
- Returns:
One
GlobalSearchGroupper source.
- details(source_id, manga_url, *, manga_id=None)[source]¶
Fetch full metadata and chapters for one manga.
- Parameters:
- Return type:
- Returns:
A
MangaDetails.
- pages(source_id, chapter_url, *, branch=None)[source]¶
Resolve the readable image pages of a chapter.
- prefs(manga_id)[source]¶
Fetch the stored reader preferences for a manga.
- Parameters:
manga_id (
str) – Identifier of the manga.- Return type:
- Returns:
The manga’s
MangaPrefs.
nyora.services.library¶
Library, history, favourites, bookmarks, and categories.
- class nyora.services.library.LibraryService(client)[source]¶
Bases:
objectManage reading history, favourites, bookmarks, and categories.
Attached to a client as
client.library.- Parameters:
client (
Nyora)
Bind the service to a helper client.
- Parameters:
client (
Nyora) – The owningnyora.client.Nyorainstance.
- history(limit=100)[source]¶
Return recent reading history.
- Parameters:
limit (
int) – Maximum number of entries to return.- Return type:
- Returns:
The most recent
HistoryEntryrecords.
- record_history(*, manga_id, chapter_id, page, percent)[source]¶
Record reading progress for a chapter.
- remove_history(manga_id, chapter_id=None)[source]¶
Remove history for a manga, optionally narrowed to one chapter.
nyora.services.downloads¶
Download operations.
- class nyora.services.downloads.DownloadsService(client)[source]¶
Bases:
objectStart, enqueue, monitor, and configure chapter downloads.
Attached to a client as
client.downloads.- Parameters:
client (
Nyora)
Bind the service to a helper client.
- Parameters:
client (
Nyora) – The owningnyora.client.Nyorainstance.
- start(*, source_id, manga_url, chapter_url, manga_title='', chapter_title='')[source]¶
Start downloading a single chapter.
- Parameters:
- Return type:
- Returns:
The created
Downloadtask.
- enqueue(*, source_id, manga_url, chapters, manga_title='')[source]¶
Enqueue multiple chapters for download.
- settings()[source]¶
Return the current download settings.
- Return type:
- Returns:
The
DownloadSettings.
- save_settings(*, max_concurrent=None, format=None)[source]¶
Update download settings.
- Parameters:
- Return type:
- Returns:
The updated
DownloadSettings.
nyora.services.backup¶
Includes BackupService, LocalService, TrackerService, and SystemService.
Backup, sync, local file, tracker, and system operations.
Defines several helper-backed services: BackupService (export/import),
LocalService (local file scanning), TrackerService (AniList
tracking), and SystemService (stats, settings, OTA) which composes the
local and tracker services. SystemService is attached to a client as
client.system; the rest are reachable as client.system.local etc.
Cloud sync is a separate client: nyora.sync.NyoraSync.
- class nyora.services.backup.BackupService(client)[source]¶
Bases:
objectExport and import the helper’s library backup.
Attached to a client as
client.backup.- Parameters:
client (
Nyora)
Bind the service to a helper client.
- Parameters:
client (
Nyora) – The owningnyora.client.Nyorainstance.
- export()[source]¶
Export the full backup archive.
- Return type:
- Returns:
The backup payload as returned by the helper.
- import_(backup_json)[source]¶
Import a previously exported backup.
- Parameters:
backup_json (
str|bytes) – The backup payload as JSON text or bytes.- Return type:
- Returns:
A
BackupImportResultsummarizing the import.
- class nyora.services.backup.LocalService(client)[source]¶
Bases:
objectScan and read locally stored manga files.
Reachable as
client.system.local.- Parameters:
client (
Nyora)
Bind the service to a helper client.
- Parameters:
client (
Nyora) – The owningnyora.client.Nyorainstance.
- class nyora.services.backup.TrackerService(client)[source]¶
Bases:
objectProgress-tracking integrations (AniList).
Reachable as
client.system.tracker.- Parameters:
client (
Nyora)
Bind the service to a helper client.
- Parameters:
client (
Nyora) – The owningnyora.client.Nyorainstance.
- class nyora.services.backup.SystemService(client)[source]¶
Bases:
objectSystem-level operations: stats, settings, OTA, and sub-services.
Attached to a client as
client.system. ComposesLocalService(.local) andTrackerService(.tracker).Cloud sync now lives in the standalone
nyora.sync.NyoraSyncclient (OAuth2/JWT against the Nyora sync server), not onclient.system.- Variables:
local – Local-file operations.
tracker – Progress-tracking operations.
- Parameters:
client (
Nyora)
Bind the service to a helper client and build sub-services.
- Parameters:
client (
Nyora) – The owningnyora.client.Nyorainstance.