Skip to main content

A python wrapper for the Kavita API

Project description

A python wrapper for the Kavita API

Table of Contents

Installation

Use pip in your terminal of choice.
$ python -m pip install kavitapy

This library requires Python 3. Testing is done on Python 3.10

Usage

Import the package using

import kavitapy

Plugin authentication

Plugin authentication is done automatically whenever you call an object or one of its methods.
For example:

kavitapy.Reader("url","apikey")

Your token can also be accessed.

kavitapy.Reader("url","apikey").token

Replace url with your server address. Make sure to include http:// or https://.
Replace apikey with your user's API key. You can find it under the 3rd Party Clients tab in your user settings in the webinterface.

HTTP Status Code

Any method returns the full http response. Use .status_code to view the returned status code

kavitapy.Reader("url","apikey").status_code
kavitapy.Reader("url","apikey").chapter_info(Chapter ID(Int)).status_code

Returned Contents

Many of the methods return not only as status code, but also other content. For example, a list of Books or Manga matching a particular query.
Use .content to view the raw response

kavitapy.Library("url","apikey").search(Query(String)).content

Often times the response content can also be parsed by decoding it with .json()

...
import json
...
kavitapy.Library("url","apikey").search(Query(String)).json()

/api/Reader endpoints

Return information about a single chapter

kavitapy.Reader("url","apikey").chapter_info(Chapter(Int))

Return content: Json

Mark all series in the list as read or unread

kavitapy.Reader("url","apikey").mark_multiple_series("operation",Series(List))

operation can be either read or unread.
Return content: None

Mark all series in the list as read

kavitapy.Reader("url","apikey").mark_multiple_series_read(Series(List))

Return content: None

Mark all series in the list as unread

kavitapy.Reader("url","apikey").mark_multiple_series_unread(Series(List))

Return content: None

Return progress for a chapter

kavitapy.Reader("url","apikey").get_progress(Chapter(Int))

Return content: Json

Set reading progress on chapter

kavitapy.Reader("url","apikey").progress(Series(Int),Volume(Int),Chapter(Int),Page(Int),[Bookscroll(String)])

Setting Bookscroll is optional
Return content: Json

Return the current progress on a series

kavitapy.Reader("url","apikey").continue_point(Series(Int))

Return content: Json

/api/Library endpoints

Return all libraries

kavitapy.Library("url","apikey").content

Return content: Json

Scan the given library

kavitapy.Library("url","apikey").scan(Library(int))

Return content: None

Search series by name

kavitapy.Library("url","apikey").search(Query(String))

Return content: Json

/api/Series endpoints

Return all series. Allows you to specify a variety of filters

kavitapy.Series("url","apikey").default([Library(Int)],[PageNumber(Int)],[PageSize(Int)],[ReadStatus(Dict)],[RequestBody(Dict)])

This method does not require any parameters.
The Parameters RequestBody and ReadStatus are mutually exclusive.

This is the format for ReadStatus

{"unread": True,
 "in_progress": True,
 "read": True}

See the official API Documentation for RequestBody
Return content: Json

Return all volumes, chapters and page progress for a series

kavitapy.Series("url","apikey").volumes(Series(Int))

Return content: Json

Return information about the given volume

kavitapy.Series("url","apikey").volume(Volume(Int))

Return content: Json

Versioning

This project aims to follow the PEP 440 specification versioning.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kavitapy-0.3.0a1.tar.gz (17.4 kB view hashes)

Uploaded Source

Built Distribution

kavitapy-0.3.0a1-py3-none-any.whl (18.3 kB view hashes)

Uploaded Python 3

Supported by

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