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)#
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, limit=1)#
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_stream_links(anime)#
This function is a coroutine.
Return all streaming link of an Anime object
- Parameters
anime (
Anime
) – The anime to get stream links- Return type
Optional
[List
[StreamLink
]]
- async get_trending_entry(type)#
This function is a coroutine.
Return a list of anime or manga
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
- async search_character(query, limit=1)#
This function is a coroutine.
Shortcut function to
search()
with the type parameter populated by the “character” keywordNew in version 0.3.0.
- Parameters
query (
str
) – Represents the search querylimit (
int
) – Limit the search to a specific number of results
Note
By searching characters, you will not get
askitsu.Character.media_id
andaskitsu.Character.role
attributes
Anime#
Anime#
- class askitsu.Anime(attributes, http, *args)#
Bases:
askitsu.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
- slug#
String identifier. Work as id to fetch data
- Type
str
- synopsis#
Description of the given anime
- 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
- 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
- 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’]
- property cover_image#
Return cover image dict with all sizes
Changed in version 0.4.1.
Now it returns a cover image object
- Return type
- property created_at#
When the media got added in Kitsu database
- Return type
Optional
[datetime
]
- property ended_at#
Date when Media ended
- Return type
Optional
[datetime
]
- async episodes(limit=12)#
Returns an episode or a list of episodes
New in version 0.4.0.
- limit:
int
Limit of episodes to fetch. Defaults to 12 (Max 25).
- limit:
- async reviews(limit=1)#
Get all the reviews of the Media
New in version 0.3.0.
- property started_at#
Date when the Media started
- Return type
Optional
[datetime
]
- property title#
Return canon title of the given Media
Changed in version 0.4.1.
Now it returns an instance of
askitsu.Title
- Return type
- property updated_at#
Last time the media got updated in Kitsu database
- Return type
Optional
[datetime
]
- property url#
str
Returns url to Kitsu.io websiteNew in version 0.4.0.
- Type
url
- Return type
str
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
- property created_at#
Date when this episode got added on Kitsu
- Return type
Optional
[datetime
]
- property updated_at#
Last time when this episode got updated on Kitu
- Return type
Optional
[datetime
]
StreamingLinks#
- class askitsu.StreamLink(attributes, included)#
Represent an
Anime
stream link (where you can watch the anime)- id#
ID of Anime Stream links
- Type
int
- url#
URL of streaming service
- Type
str
- subs#
Avaiable subs
- Type
list
- dub#
Avaiable dub in streaming service
- Type
list
- name#
Name of the stream service
- Type
str
Manga#
Manga#
- class askitsu.Manga(attributes, http, *args)#
Bases:
askitsu.core.Entry
Represents a
Manga
instance- id#
ID of the manga
- Type
int
- status#
Actual status of the given manga (E.g. “finished”)
- Type
str
- slug#
String identifier. Work as id to fetch data
- Type
str
- synopsis#
Description of the given manga
- 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
- serialization#
Return manga serialization
- Type
str
- rating_rank#
Return rating rank
- Type
int
- popularity_rank#
Return popularity rank position
- Type
int
- 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’]
- async chapters(limit=12)#
Returns a chapter list of chapters
New in version 0.4.0.
- limit:
int
Limit of chapters to fetch. Defaults to 12 (Max 20).
- limit:
- property cover_image#
Return cover image dict with all sizes
Changed in version 0.4.1.
Now it returns a cover image object
- Return type
- property created_at#
When the media got added in Kitsu database
- Return type
Optional
[datetime
]
- property ended_at#
Date when Media ended
- Return type
Optional
[datetime
]
- async reviews(limit=1)#
Get all the reviews of the Media
New in version 0.3.0.
- property started_at#
Date when the Media started
- Return type
Optional
[datetime
]
- property title#
Return canon title of the given Media
Changed in version 0.4.1.
Now it returns an instance of
askitsu.Title
- Return type
- property updated_at#
Last time the media got updated in Kitsu database
- Return type
Optional
[datetime
]
- property url#
str
Returns url to Kitsu.io websiteNew in version 0.4.0.
- Type
url
- Return type
str
Chapter#
- class askitsu.Chapter(attributes)#
Represent a
Manga
chapter- id#
ID of the chapter
- Type
int
- synopsis#
Synopsis of the chapter
- Type
str
- 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
- lenght#
Pages of the chapter
- Type
int
- thumbnail#
Url of the thumbnail
- Type
str
- property created_at#
Date when a chapter got added on Kitsu DB
- Return type
Optional
[datetime
]
- property published#
Date when a Chapter got published (YYYY-mm-dd)
- Return type
Optional
[datetime
]
Users#
User#
- class askitsu.User(attributes, http)#
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
- likes_given#
Number of likes given by the user
- Type
int
- likes_received#
Number of likes received by the user
- Type
int
- posts_count#
Number of posts
- Type
int
- rating_count#
Number of ratings made by the user
- Type
int
- media_reaction#
Number of interaction with medias
- Type
int
- pro#
Return if the user has pro tier
- Type
bool
- status#
Status of the user (if they’re registered or not)
- Type
str
- title#
Title of the user (if has one) Example: “Staff”
- Type
Optional[
str
]
- profile_completed#
Return if the user has completed his profile
- Type
bool
- feed_completed#
If the user completed their feed
- Type
bool
- sfw_filter#
Current SFW filter of the user
- Type
str
- property banner#
Background of the user profile
- Return type
Optional
[CoverImage
]
- property birthday#
Birthday of the user (if set)
- Return type
Optional
[datetime
]
- property past_names#
Past names of the user (if avaiable)
- Return type
Optional
[list
]
UserProfile#
- class askitsu.UserProfile(id, attributes, user, included)#
A profile linked to a
User
- id#
The id of the profile link
- Type
int
- name#
Name of the linked profile
- Type
str
- user#
Name of the user whom the profile belong to
- Type
str
- url#
The url to the profile of the user
- Type
str
- property created_at#
When the user added the link to their profile
- Return type
Optional
[datetime
]
- property updated_at#
When the user last updated the link
- 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, *, role=None, 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
]
- mal_id#
Character ID on My Anime List
- Type
int
- image#
Return character’s image
- Type
str
- property created_at#
When a character got added in Kitu DB
- Return type
Optional
[datetime
]
- property updated_at#
Last time a character got updated
- Return type
Optional
[datetime
]
Reviews#
- class askitsu.Review(entry_id, entry_type, attributes)#
Represents a
Review
instance. Reviews belong to a media (Anime
,Manga
)New in version 0.3.0.
- id#
ID of the review
- Type
int
- content#
Content of the review
- Type
str
- content_formatted#
Formatted content of the review
- Type
str
- likes_count#
How many likes a reviews has
- Type
int
- progress#
- Type
str
- rating#
Rating of the review
- Type
int
- source#
Source of the review
- Type
int
- spoiler#
If the review is/has a spoiler or not
- Type
bool
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#
- class askitsu.Image(data)#
Represent a general image
- 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
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
- medium#
Cover image – size: medium
- 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
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.