Info#
Async Kitsu API Wrapper#
Simple & asynchronus wrapper for the Kitsu API Written in python
- copyright
2022-present ShomyKohai
- license
MIT, see LICENSE
Core#
Client#
- class askitsu.Client(token=None, *, session=None, cache_expiration=300)#
Represents a client connection to get data from Kitsu.io API
- Parameters
token (
str
) –Access token to make authenticated requests.
Useful when you need to fetch NSFW content, interact with users or post something.
New in version 0.4.1.
session (Optional[
aiohttp.ClientSession
]) – An object that represents the effective connection
- token#
Token passed to the session.
- Type
str
- async check_user(slug)#
This function is a coroutine.
Check if the user exists on Kitsu
New in version 0.5.0.
- Parameters
slug (
str
) – Nickname of the user- Return type
bool
- async close()#
Close client connection
- Return type
None
- async get_anime_entry(id)#
This function is a coroutine.
Shortcut for
get_entry()
; returns only Anime object- Parameters
id (
int
) – ID of the anime- Return type
- async get_characters(entry)#
This function is a coroutine.
- async get_entry(type, id)#
This function is a coroutine.
Get an entry object (Anime | Manga | Character) by an id
- async get_manga_entry(id)#
This function is a coroutine.
Shortcut for
get_entry()
; returns only Manga objectNew in version 0.3.0.
- Parameters
id (
int
) – ID of the manga- Return type
- async get_reviews(entry, limit=1)#
This function is a coroutine.
Get reviews of a given entry
New in version 0.3.0.
- async get_trending_entry(type, limit=10)#
This function is a coroutine.
Return a list of anime or manga (max of 10)
New in version 0.2.1.
- async get_user(id)#
This function is a coroutine.
Get a user by their id
New in version 0.5.0.
- Parameters
id (
int
) – The id of the user to fetch- Return type
Optional
[User
]
- async search(type, query, limit=1)#
This function is a coroutine.
Search trough Kitsu API with the providen query and fetch the found data
- async search_anime(query, limit=1)#
This function is a coroutine.
Shortcut function to
search()
with the type parameter populated by the “anime” keyword
Anime#
Anime#
- class askitsu.Anime(attributes, http, cache)#
Bases:
askitsu.models.core.Entry
Represents an
Anime
instance- id#
ID of the anime
- Type
int
- status#
Actual status of the given anime (E.g. “finished”)
- Type
str
- started_at#
Date when the anime started
- Type
Optional[
datetime
]
- ended_at#
Date when the anime ended
- Type
Optional[
datetime
]
- slug#
String identifier. Work as id to fetch data
- Type
str
- title#
Return canon title of the given anime
Changed in version 0.4.1.
Now it returns an instance of
askitsu.Title
- Type
str
- canonical_title#
Returns canonical title of the given anime
New in version 0.4.1.
- Type
str
- episode_count#
Episode number
- Type
int
- episode_lenght#
Lenght of a single episode of the anime
- Type
int
- total_lenght#
Total lenght of all episodes (minutes)
- Type
int
- nsfw#
Check if the anime is NSFW or SFW Return True | False
- Type
bool
- yt_id#
Return id of the YouTube trailer
- Type
str
- cover_image#
Return cover image dict with all sizes
Changed in version 0.4.1.
Now it returns a cover image object
- Type
- poster_image#
Return poster image dict with all sizes
Changed in version 0.4.1.
Now it returns a poster image object
- Type
- rating_rank#
Return rating rank (Position on the leaderboard based on rating)
- Type
int
- popularity_rank#
Return popularity rank (Position on the leaderboard based on user preferences)
- Type
int
- youtube_url#
Return full url of YouTube trailer
- Type
Optional[
str
]
- url#
Returns url to Kitsu.io website
New in version 0.4.0.
- Type
str
- stream_links#
Return a list of :class:StreamLink
New in version 0.4.0.
- Type
List[
StreamLink
]
- rating#
The rating received from the community in a scale from 1 to 100
New in version 0.4.0.
- Type
float
- age_rating#
Age rating of the anime
New in version 0.4.0.
- Type
Literal[‘G’, ‘PG’, ‘R’, ‘R18’]
- subtype#
The subtype of the show
New in version 0.4.1.
- Type
Literal[‘ONA’, ‘OVA’, ‘TV’, ‘movie’, ‘music’, ‘special’]
- characters#
Get all characters (Max 20)
New in version 0.4.1.
Note
Use
askitsu.Client.get_characters()
if you want to set a limitThe limit with this property is automatically set to 20 (The highest)
Episode#
- class askitsu.Episode(attributes)#
Represent an
Anime
episodeNew in version 0.4.0.
- id#
ID of the episode
- Type
int
- synopsis#
Synopsis of the episode
- Type
str
- description#
Full description of the episode
- Type
str
- title#
Title of the episode
- Type
str
- season#
Season which the episode belong to
- Type
int
- number#
Episode’s number
- Type
int
- lenght#
Lenght of the episode (in minutes)
- Type
int
- thumbnail#
Url of the thumbnail
- Type
str
StreamingLinks#
Manga#
Manga#
- class askitsu.Manga(attributes, http, cache)#
Bases:
askitsu.models.core.Entry
Represents a
Manga
instance- id#
ID of the manga
- Type
int
- status#
Actual status of the given manga (Ex. “finished”)
- Type
str
- started_at#
Date when the manga started
- Type
Optional[
datetime
]
- ended_at#
Date when the manga ended
- Type
Optional[
datetime
]
- slug#
String identifier. Work as id to fetch data
- Type
str
- title#
Return canon title of the given manga
Changed in version 0.4.1.
Now it returns an instance of
askitsu.Title
- Type
str
- canonical_title#
Returns canonical title of the given manga
New in version 0.4.1.
- Type
str
- chapter_count#
Number of chapters
- Type
int
- volume_count#
Number of volumes
- Type
int
- cover_image#
Return cover image dict with all sizes
Changed in version 0.4.1.
Now it returns a cover image object
- Type
- poster_image#
Return poster image dict with all sizes
Changed in version 0.4.1.
Now it returns a poster image object
- Type
- rating_rank#
Return rating rank
- Type
int
- popularity_rank#
Return popularity rank position
- Type
int
- url#
Returns url to Kitsu.io website
New in version 0.4.0.
- Type
str
- rating#
The rating received from the community in a scale from 1 to 100
New in version 0.4.0.
- Type
float
- age_rating#
Age rating of the manga
New in version 0.4.0.
- Type
Literal[‘G’, ‘PG’, ‘R’, ‘R18’]
- subtype#
The subtype of the manga
New in version 0.4.1.
- Type
Literal[‘doujin’, ‘manga’, ‘manhua’, ‘manhwa’, ‘novel’, ‘oel’, ‘oneshot’]
- characters#
Get all characters (Max 20)
New in version 0.4.1.
Note
Use
askitsu.Client.get_characters()
if you want to set a limitThe limit with this property is automatically set to 20 (The highest)
Chapter#
- class askitsu.Chapter(attributes)#
Represent a
Manga
chapter- id#
ID of the chapter
- Type
int
- description#
Full description of the chapter
- Type
str
- title#
Title of the chapter
- Type
str
- volume_number#
Which volume the chapter belong to
- Type
int
- chapter#
Chapter number
- Type
int
- property thumbnail#
Url of the thumbnail
- Return type
Optional
[str
]
Users#
User#
- class askitsu.User(attributes, http, cache)#
Represents a user of Kitsu
New in version 0.5.0.
- id#
The id of the user
- Type
int
- name#
Name of the user
- Type
str
- slug#
String identifier of the user (nickname)
- Type
str
- about#
About section of the user (description)
- Type
str
- location#
Location of the user (if set)
- Type
Optional[
str
]
- waifu_husbando#
Return the choice of the user if they have a waifu or an husbando
- Type
str
- followers#
Followers count of the users
- Type
int
- following#
Number of users that the user is following
- Type
int
- gender#
Gender of the user (if set)
- Type
Optional[
str
]
- comments_count#
Number of comment posted by the user
- Type
int
- favorites_count#
Number of favorites media of the user
- Type
int
- posts_count#
Number of posts
- Type
int
- media_reaction#
Number of interaction with medias
- Type
int
- pro#
Return if the user has pro tier
- Type
bool
- pro_tier#
Return the typology of pro
- Type
Optional[
str
]
- property banner#
Same as
cover_image()
- Return type
Optional
[CoverImage
]
- property birthday#
Birthday of the user (if set)
- Return type
Optional
[datetime
]
- property cover_image#
Background of the user profile
- Return type
Optional
[CoverImage
]
- property created_at#
When the user registered to Kitsu
- Return type
Optional
[datetime
]
- property profile_links#
Social linked to the profile
- Return type
Optional
[List
[UserProfile
]]
UserProfile#
Post#
- class askitsu.Post(attributes, author)#
A post made by a
User
- id#
ID of the post
- Type
int
- content#
Formatted content of the post
- Type
str
- nsfw#
If the post is marked as NSFW by the author
- Type
bool
- likes_count#
Number of likes in the post
- Type
int
- spoiler#
If the post is marked as spoiler by the author
- Type
bool
- property created_at#
When the user registered to Kitsu
- Return type
Optional
[datetime
]
LibraryEntry#
- class askitsu.LibraryEntry(attributes, user, http)#
A library entry that belongs to a
User
- id#
ID of the LibraryEntry
- Type
int
- status#
Status of the Media in the library entry
- Type
- reconsume_count#
Number of reconsume of a media (E.g. Rewatch in Anime)
- Type
int
- reconsuming#
If the user is currently reconsuming the Media
- Type
bool
- rating#
Rating of the Media given by the user
- Type
Optional[
int
]
- private#
If the library entry is private
- Type
bool
- progress#
Progress of the user in the linked media
- Type
int
- media_type#
The type of the linked media: Anime or Manga
- Type
str
- media_id#
The ID of the linked media
- Type
int
- nsfw#
If the library entry is NSFW or not
- Type
bool
- notes#
Additional notes made by the user
- Type
Optional[
str
]
- property created_at#
When the library entry got created
- Return type
Optional
[datetime
]
- property finished_at#
When the library entry got finished
- Return type
Optional
[datetime
]
- property progressed_at#
When the library entry got a progress update
- Return type
Optional
[datetime
]
Misc#
Categories#
- class askitsu.Category(attributes)#
Represent a category of a media.
New in version 0.4.0.
- title#
Title of the category
- Type
str
- description#
Description of the category
- Type
str
- slug#
Identifier string of the category
- Type
str
- nsfw#
If the category is NSFW or not
- Type
bool
- property created_at#
When a category got added in Kitu DB
- Return type
Optional
[datetime
]
- property updated_at#
Last time a category got updated
- Return type
Optional
[datetime
]
Character#
- class askitsu.Character(attributes, entry_id=None, **kwargs)#
Represents a
Character
istanceNew in version 0.2.0.
- media_id#
ID of the character’s origin media
- Type
int
- id#
ID of the character
- Type
int
- name#
Return characters canonical name
- Type
str
- slug#
String identifier. Work as id to fetch data
- Type
str
- description#
The character’s description
- Type
str
- role#
Role of the character (“main” or “supporting”)
- Type
Literal[
str
]
- image#
Return character’s image
- Type
str
Reviews#
Titles#
- class askitsu.Title(data, entry_id=None, entry_type=None)#
Represent the various titles that a entry can have
- entry_id#
The id of the media which the title belong to
- Type
int
- entry_type#
The type of the media (anime, manga)
- Type
str
- en#
The title of the media in English
- Type
str
- en_jp#
The title of the media in romanized Japanese
- Type
str
- ja_jp#
The title of the media in Japanese
- Type
str
Assets#
Image#
CoverImage#
- class askitsu.CoverImage(data, entry_id=None, entry_type=None)#
Cover image of a media
- entry_id#
The id which the cover image belongs to
- Type
int
- entry_type#
The type of the media
- Type
str
- tiny#
Cover image – size: tiny
- Type
str
- small#
Cover image – size: small
- Type
str
- large#
Cover image – size: large
- Type
str
- original#
Cover image with original size
- Type
str
PosterImage#
- class askitsu.PosterImage(data, entry_id=None, entry_type=None)#
Poster image of a media
- entry_id#
The id which the poster image belongs to
- Type
int
- entry_type#
The type of the media
- Type
str
- tiny#
Poster image – size: tiny
- Type
str
- small#
Poster image – size: small
- Type
str
- medium#
Poster image – size: medium
- Type
str
- large#
Poster image – size: large
- Type
str
- original#
Poster image with original size
- Type
str
Enums#
Entries#
MediaType#
LibraryEntryStatus#
Errors#
AskitsuException#
HTTPError#
- exception askitsu.HTTPError(msg, status)#
Represents a generic HTTP error.
- Parameters
msg (
str
) – Error messagestatus (
int
) – Code of the HTTP response
InvalidArgument#
- exception askitsu.InvalidArgument(msg=None)#
Raises when an invalid entry gets passed
- Parameters
msg (
str
) – Error message to pass
NotAuthenticated#
- exception askitsu.NotAuthenticated#
Raises when an Authenticated API request get place without being authenticated
New in version 0.3.0.
BadApiRequest#
- exception askitsu.BadApiRequest(response)#
Raises when a 400 error code takes place
New in version 0.4.0.