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
Scan the given library
kavitapy.Library("url","apikey").scan(Library(int))
Return content: None
Return all libraries
kavitapy.Library("url","apikey").libraries()
Alternatively, you can also use the method named default
kavitapy.Library("url","apikey").default()
Return content: Json
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for kavitapy-0.2.0a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc20df37986c02259a22c7bba1514c64752325218c464c85df15058914e1455b |
|
MD5 | f4999a6a476e7a833dd9bc15998ece5e |
|
BLAKE2b-256 | 398750d6363bbfb3d5403989fcd2f85fff781cd97f02789314deb35f524abb9d |