anime_list_apis.api package¶
Submodules¶
anime_list_apis.api.AnilistApi module¶
-
class
anime_list_apis.api.AnilistApi.
AnilistApi
(cache: anime_list_apis.cache.Cache.Cache = None, rate_limit_pause: float = 0.5)¶ Bases:
anime_list_apis.api.ApiInterface.ApiInterface
Implements a wrapper around the anilist.co API
-
__init__
(cache: anime_list_apis.cache.Cache.Cache = None, rate_limit_pause: float = 0.5)¶ Initializes the Anilist Api interface. Intializes cache or uses the one provided. :param cache: The cache to use. If left as None, will use default cache :param rate_limit_pause: A duration in seconds that the API Interface
will pause after a network operation to prevent being rate limited
-
get_anilist_id_from_mal_id
(media_type: anime_list_apis.models.attributes.MediaType.MediaType, mal_id: int) → Optional[int]¶ Retrieves an anilist ID from a myanimelist ID :param media_type: The media type of the myanimelist ID :param mal_id: The myanimelist ID :return: The anilist ID. May be None if myanimelist ID has no
equivalent on anilist
-
anime_list_apis.api.ApiInterface module¶
-
class
anime_list_apis.api.ApiInterface.
ApiInterface
(id_type: anime_list_apis.models.attributes.Id.IdType, cache: anime_list_apis.cache.Cache.Cache = None, rate_limit_pause: float = 0.0)¶ Bases:
object
Defines methods that every API connector should implement
-
__init__
(id_type: anime_list_apis.models.attributes.Id.IdType, cache: anime_list_apis.cache.Cache.Cache = None, rate_limit_pause: float = 0.0)¶ Initializes the Api interface. Intializes cache or uses the one provided. :param id_type: TheID type of the API Interface :param cache: The cache to use. If left as None, will use default cache :param rate_limit_pause: A duration in seconds that the API Interface
will pause after a network operation to prevent being rate limited
-
get_anime_data
(_id: int, fresh: bool = False) → Optional[anime_list_apis.models.MediaData.AnimeData]¶ Shortcut for get_data that retrieves only Anime media :param _id: The ID to fetch. May be int or Id object :param fresh: Fetches a fresh, i.e. non-cached version :return: The retrieved AnimeData object or None if not a valid ID
-
get_anime_list
(username: str) → List[anime_list_apis.models.MediaListEntry.AnimeListEntry]¶ Retrieves a user’s complete anime list :param username: The user’s username :return: The user’s list of AnimeListEntry objects
-
get_anime_list_entry
(_id: int, username: str, fresh: bool = False) → Optional[anime_list_apis.models.MediaListEntry.AnimeListEntry]¶ Retrieves a user’s list entry for a single entry :param _id: The ID to fetch. May be int or an Id object :param username: The user for which to fetch the entry :param fresh: Fetches a fresh, i.e. non-cached version :return: The Anime List Entry or None if there is not such entry
-
get_anime_user_data
(_id: int, username: str, fresh: bool = False) → Optional[anime_list_apis.models.MediaUserData.AnimeUserData]¶ Retrieves a user’s user data for a single entry :param _id: The ID to fetch. May be int or an Id object :param username: The user for which to fetch the user data :param fresh: Fetches a fresh, i.e. non-cached version :return: The AnimeUserData or None if there is not such entry
-
get_anime_user_data_list
(username: str) → List[anime_list_apis.models.MediaUserData.AnimeUserData]¶ Retrieves a user’s complete anime list of user data objects :param username: The user’s username :return: The user’s list of AnimeUserData objects
-
get_data
(media_type: anime_list_apis.models.attributes.MediaType.MediaType, _id: int, fresh: bool = False) → Optional[anime_list_apis.models.MediaData.MediaData]¶ Retrieves a single data object using the API Tries to get the cached value first, then checks Anilist :param media_type: The media type to retrieve :param _id: The ID to retrieve. May be either an int or an Id object :param fresh: Fetches a fresh, i.e. non-cached version :return: The Media Data or None if no valid data was found
-
get_list
(media_type: anime_list_apis.models.attributes.MediaType.MediaType, username: str) → List[anime_list_apis.models.MediaListEntry.MediaListEntry]¶ Retrieves a user’s entire list Stores all entries in the cache upon completion :param media_type: The media type to fetch :param username: The username for which to fetch the list :return: The list of List entries
-
get_list_entry
(media_type: anime_list_apis.models.attributes.MediaType.MediaType, _id: int, username: str, fresh: bool = False) → Optional[anime_list_apis.models.MediaListEntry.MediaListEntry]¶ Retrieves a user list entry. First checks for cached entries, otherwise fetches from anilist :param media_type: The media type to fetch :param _id: The ID to retrieve. May be and int or an Id object :param username: The user for which to fetch the entry :param fresh: Fetches a fresh, i.e. non-cached version :return: The entry for the user or
None if the user doesn’t have such an entry
-
get_manga_data
(_id: int, fresh: bool = False) → Optional[anime_list_apis.models.MediaData.MangaData]¶ Shortcut for get_data that retrieves only Manga media :param _id: The ID to fetch. May be int or Id object :param fresh: Fetches a fresh, i.e. non-cached version :return: The retrieved MangaData object or None if not a valid ID
-
get_manga_list
(username: str) → List[anime_list_apis.models.MediaListEntry.MangaListEntry]¶ Retrieves a user’s complete manga list :param username: The user’s username :return: The user’s list of MangaListEntry objects
-
get_manga_list_entry
(_id: int, username: str, fresh: bool = False) → Optional[anime_list_apis.models.MediaListEntry.MangaListEntry]¶ Retrieves a user’s list entry for a single entry :param _id: The ID to fetch. May be int or an Id object :param username: The user for which to fetch the entry :param fresh: Fetches a fresh, i.e. non-cached version :return: The Manga List Entry or None if there is not such entry
-
get_manga_user_data
(_id: int, username: str, fresh: bool = False) → Optional[anime_list_apis.models.MediaUserData.MangaUserData]¶ Retrieves a user’s user data for a single entry :param _id: The ID to fetch. May be int or an Id object :param username: The user for which to fetch the user data :param fresh: Fetches a fresh, i.e. non-cached version :return: The MangaUserData or None if there is not such entry
-
get_manga_user_data_list
(username: str) → List[anime_list_apis.models.MediaUserData.AnimeUserData]¶ Retrieves a user’s complete manga list of user data objects :param username: The user’s username :return: The user’s list of MangaUserData objects
Retrieves related data for either a list of MediaData objects or a single MediaData object :param datas: A list of MediaData objects (or a single one) :param fresh: Indicates if the most up-to-date results should be used :return: A list of related media data
-
get_user_data
(media_type: anime_list_apis.models.attributes.MediaType.MediaType, _id: int, username: str, fresh: bool = True) → Optional[anime_list_apis.models.MediaUserData.MediaUserData]¶ Retrieves the user data of a single entry for a user :param media_type: The type of media to fetch :param _id: The ID to fetch :param username: The username for which to fetch :param fresh: Fetches a fresh, i.e. non-cached version :return: The MediaUserData object or None if not found
-
get_user_data_list
(media_type: anime_list_apis.models.attributes.MediaType.MediaType, username: str) → List[anime_list_apis.models.MediaUserData.MediaUserData]¶ Retrieves a user’s entire list with only the user data :param media_type: The media type to fetch the entries for :param username: The user for whom to fetch the entries for :return: The retrieves user data in a list
-
is_in_anime_list
(_id: int, username: str, fresh: bool = False) → bool¶ Checks if an entry is in a user’s list :param _id: The ID to check for :param username: The username for which to check :param fresh: Indicates if the most up-to-date results should be used :return: True if the id is in the list, False otherwise
-
is_in_list
(media_type: anime_list_apis.models.attributes.MediaType.MediaType, _id: int, username: str, fresh: bool = False) → bool¶ Checks if an entry is in a user’s list :param media_type: The media type to check for :param _id: The ID to check for :param username: The username for which to check :param fresh: Indicates if the most up-to-date results should be used :return: True if the id is in the list, False otherwise
-
is_in_manga_list
(_id: int, username: str, fresh: bool = False) → bool¶ Checks if an entry is in a user’s manga list :param _id: The ID to check for :param username: The username for which to check :param fresh: Indicates if the most up-to-date results should be used :return: True if the id is in the list, False otherwise
-
anime_list_apis.api.KitsuApi module¶
-
class
anime_list_apis.api.KitsuApi.
KitsuApi
(cache: anime_list_apis.cache.Cache.Cache = None, rate_limit_pause: float = 0.0)¶ Bases:
anime_list_apis.api.ApiInterface.ApiInterface
Implements a wrapper around the kitsu.io API
-
__init__
(cache: anime_list_apis.cache.Cache.Cache = None, rate_limit_pause: float = 0.0)¶ Initializes the Kitsu Api interface. Intializes cache or uses the one provided. :param cache: The cache to use. If left as None, will use default cache :param rate_limit_pause: A duration in seconds that the API Interface
will pause after a network operation to prevent being rate limited
-
anime_list_apis.api.MyanimelistApi module¶
-
class
anime_list_apis.api.MyanimelistApi.
MyanimelistApi
(cache: anime_list_apis.cache.Cache.Cache = None, rate_limit_pause: float = 0.0)¶ Bases:
anime_list_apis.api.ApiInterface.ApiInterface
Implements a wrapper around the myanimelist.net API
-
__init__
(cache: anime_list_apis.cache.Cache.Cache = None, rate_limit_pause: float = 0.0)¶ Initializes the Myanimelist Api interface. Intializes cache or uses the one provided. :param cache: The cache to use. If left as None, will use default cache :param rate_limit_pause: A duration in seconds that the API Interface
will pause after a network operation to prevent being rate limited
-