Pyanimelist¶
About¶
Pyanimelist is an asynchronous wrapper for the MyAnimeList API, using lxml and aiohttp.
Installation¶
Pyanimelist will only work on Python 3.5+ as it heavily uses the Typing library, which is only available from 3.5 onwards. It also uses the 3.5 syntax async def rather than the @asyncio.coroutine.
Pyanimelist is installed through pip for the latest released version.
$ pip install pyanimelist
If you want the latest development version you can install from the git repo on GitHub
$ pip install git+https://github.com/GetRektByMe/Pyanimelist.git
Note that the Git version isn’t guarenteed to be work properly and lots of things may be broken.
Contents:¶
Examples¶
Search anime¶
import asyncio
import pyanimelist
instance = pyanimelist.PyAnimeList(username, password)
loop = asyncio.get_event_loop()
loop.run_until_complete(instance.verify_credentials())
results = loop.run_until_complete(instance.search_all_anime("Mahouka koukou no rettousei"))
print(results)
Search manga¶
import asyncio
import pyanimelist
instance = pyanimelist.PyAnimeList(username, password)
loop = asyncio.get_event_loop()
loop.run_until_complete(instance.verify_credentials())
results = loop.run_until_complete(instance.search_all_manga("Mahouka koukou no rettousei"))
print(results)
Add anime¶
import asyncio
import pyanimelist
from pyanimelist.enumerations import AnimeStatus
instance = pyanimelist.PyAnimeList(username, password)
loop = asyncio.get_event_loop()
loop.run_until_complete(instance.verify_credentials())
# The first argument is the anime id, the second argument is the status
loop.run_until_complete(instance.add_anime(1, AnimeStatus.WATCHING.value))
Add manga¶
import asyncio
import pyanimelist
from pyanimelist.enumerations import MangaStatus
instance = pyanimelist.PyAnimeList(username, password)
loop = asyncio.get_event_loop()
loop.run_until_complete(instance.verify_credentials())
# The first argument is the manga id, the second is the status
loop.run_until_complete(instance.add_manga(1, MangaStatus.READING.value))
Update anime¶
import asyncio
import pyanimelist
instance = pyanimelist.PyAnimeList(username, password)
loop = asyncio.get_event_loop()
loop.run_until_complete(instance.verify_credentials())
# This can take anything specified in the docstring but nothing is required besides the animes id
loop.run_until_complete(instance.update_anime(1))
Update manga¶
import asyncio
import pyanimelist
instance = pyanimelist.PyAnimeList(username, password)
loop = asyncio.get_event_loop()
loop.run_until_complete(instance.verify_credentials())
# This can take anything specified in the docstring but nothing is required besides the animes id
loop.run_until_complete(instance.update_manga(1))
Delete anime¶
import asyncio
import pyanimelist
instance = pyanimelist.PyAnimeList(username, password)
loop = asyncio.get_event_loop()
loop.run_until_complete(instance.verify_credentials())
loop.run_until_complete(instance.delete_anime(1))
Delete manga¶
import asyncio
import pyanimelist
instance = pyanimelist.PyAnimeList(username, password)
loop = asyncio.get_event_loop()
loop.run_until_complete(instance.verify_credentials())
loop.run_until_complete(instance.delete_manga(1))
Get user series¶
import asyncio
import pyanimelist
# This can be either anime or manga
series_type = "anime"
instance = pyanimelist.PyAnimeList(username, password)
loop = asyncio.get_event_loop()
loop.run_until_complete(instance.verify_credentials())
loop.run_until_complete(instance.get_user_series(username, series_type))
Get user data¶
import asyncio
import pyanimelist
instance = pyanimelist.PyAnimeList(username, password)
loop = asyncio.get_event_loop()
loop.run_until_complete(instance.verify_credentials())
loop.run_until_complete(instance.get_user_data(username))
What’s new!¶
This page keeps a human readable list of what has changed throughout the versions, starting from v1.2.3
v1.2.3¶
- pyanimelist.errors.InvalidCredentials now inherits from ResponseError
- Switch from strings to datetime objects on
pyanimelist.abstractions.Dates
API reference¶
Note
There is currently nothing logged on the backend of Pyanimelist; This is planned to be added in future commits.
Note
The use of BeautifulSoup will soon be depreciated and will switch to an lxml backend for the one function that uses BeautifulSoup.
Client¶
Exceptions¶
Dataclasses¶
Note
These are not for creating yourself, these are handled and given to you from the libraries backend.
Enumerations¶
The API returns integers which we plug into our enumerations for easy filtering
-
class
pyanimelist.enumerations.
AnimeStatus
¶ Specifies the status of the
Anime
.-
WATCHING
¶ The anime is currently being watched
-
COMPLETED
¶ The anime has been completely watched
-
ON_HOLD
¶ The anime is currently on hold
-
DROPPED
¶ The anime was dropped mid way through watching
-
PLAN_TO_WATCH
¶ The anime has been planned to be watched
-
-
class
pyanimelist.enumerations.
MangaStatus
¶ Specifies the status of the
Manga
.-
READING
¶ The manga is currently being read
-
COMPLETED
¶ The manga has been completely read
-
ON_HOLD
¶ The manga is currently on hold
-
DROPPED
¶ The manga was dropped mid way through reading
-
PLAN_TO_READ
¶ The manga has been planned to be read
-
Abstractions¶
Note
These are used in the backend of the library and are not for using outside it!