Package: animeapi-py
animeapi-python is a Python wrapper for theAnimeAPImade bynattadasu.The wrapper is released with type hints and async support in mind for
ease of use and is compatible with Python 3.6 or higher.Installationpipinstallanimeapi-pyDepending on your system, you may need to usepip3instead ofpip, orsudo pipinstead ofpip.RequirementsPython 3.7 or higheraiohttp(for async support)daciterequeststyping_extensions(for Python <= 3.8)Usageimportanimeapiwithanimeapi.AnimeAPI()asapi:# Get anime relation data for the anime with ID 1 on MyAnimeListmal=api.get_anime_relations(1,animeapi.Platform.MYANIMELIST)print(mal)# Get list of anime available on AniListanilist=api.get_list_anime_relations(animeapi.Platform.ANILIST)print(anilist[:2])# Print first two results# Get dictionary of anime available on Kitsukitsu=api.get_dict_anime_relations(animeapi.Platform.KITSU)print(kitsu['1'])# Print data for Cowboy BebopWe recommend using thewithstatement to create an instance ofAnimeAPIas we designed the wrapper to be easy to switch between
sync and async, although you can also useAnimeAPIdirectly onsyncmethods only.Asyncronous UsageSimilarly, for async, you just need to replaceAnimeAPIwithAsyncAnimeAPIand useawaiton the methods.You must use the wrapper inwithstatement, or you will receiveRuntimeErrorexception.importanimeapiasyncwithanimeapi.AsyncAnimeAPI()asapi:# Get anime relation data for the anime with ID 1 on MyAnimeListmal=awaitapi.get_anime_relations(1,animeapi.Platform.MYANIMELIST)print(mal)# Get list of anime available on AniListanilist=awaitapi.get_list_anime_relations(animeapi.Platform.ANILIST)print(anilist[:2])# Print first two results# Get dictionary of anime available on Kitsukitsu=awaitapi.get_dict_anime_relations(animeapi.Platform.KITSU)print(kitsu['1'])# Print data for Cowboy BebopDocumentationYou can find the documentation for the wrapperhereAvailable Methodsget_anime_relations(title_id: str | int, platform: str | Platform, media_type: str | TraktMediaType | TmdbMediaType | None = None, title_season: int | None)->AnimeRelationThis method equals to the/:platform/:title_idendpoint on the API.# Get anime relation data for the anime with ID 1 on MyAnimeListmal=api.get_anime_relations(1,animeapi.Platform.MYANIMELIST)print(mal)get_dict_anime_relations(platform: str | Platform)->dict[str, AnimeRelation]This method equals to the/:platformendpoint on the API. Use this
method if you want to get complete data for all anime available on a
platform and wanted to be able to access the data by the anime ID
faster.# Get dictionary of anime available on Kitsukitsu=api.get_dict_anime_relations(animeapi.Platform.KITSU)print(kitsu['1'])# Print data for Cowboy Bebopget_list_anime_relations(platform: str | Platform)->list[AnimeRelation]This method equals to the/:platform()endpoint on the API.# Get list of anime available on AniListanilist=api.get_list_anime_relations(animeapi.Platform.ANILIST)print(anilist[:2])# Print first two resultsget_list_index()->list[AnimeRelation]This method equals to the/animeapiendpoint on the API.# Get list of anime available on AnimeAPIanimeapi=api.get_list_index()print(animeapi[:2])# Print first two resultsget_status()->ApiStatusThis method equals to the/statusendpoint on the API.# Get status of AnimeAPIstatus=api.get_status()print(status)get_heartbeat()->HeartbeatThis method equals to the/heartbeatendpoint on the API.# Get heartbeat of AnimeAPIheartbeat=api.get_heartbeat()print(heartbeat)get_updated_time()->UpdatedThis method equals to the/updatedendpoint on the API.# Get last updated time of AnimeAPIupdated=api.get_updated_time(True)print(updated)print(updated.datetime())# Convert to datetime classLicenseanimeapi-pyis licensed under theGNU Affero General Public License
v3.0.