API Reference¶
Base Class¶
-
class
malclient.Client(*, client_id=None, access_token=None, refresh_token=None, nsfw=False)¶ -
Base class for interacting with MyAnimeList REST API
- Variables
client_id – string containing client_id obtained from [client configuration on MAL](https://myanimelist.net/apiconfig)
access_token – string containing access token obtained through OAuth2
refresh_token – string containing refresh token obtained through OAuth2
-
refresh_bearer_token(client_id, client_secret, refresh_token, print_response=True)¶ -
Function to automatically refresh your clients bearer token (as for now there is no such thing as lifetime token)
- Parameters
client_id (str) – Your client id number
client_secret (str) – Your client secret
refresh_token (str) – Your refresh token
print_response (bool) – Should the response json be printed or not
Forum Boards¶
Forum boards stay pretty much untouch, either by me or previous developer, so there is nothing available at the moment I will be working on bringing it back though.
User List¶
-
Client.update_my_anime_list_status(anime_id, *, status=None, start_date=None, finish_date=None, is_rewatching=None, score=None, num_watched_episodes=None, priority=None, num_times_rewatched=None, rewatch_value=None, tags=None, comments=None, **kwargs)¶ -
Updates myanimelist status for a given anime, takes payload as dictionary as argument. Emit fields to not update. Returns updated entry from list.
- Parameters
anime_id (int) – id of anime you want to update
status (Literal["watching", "completed", "on_hold", "dropped", "plan_to_watch"]) – Watching status of series
is_rewatching (bool) – Defines if series is watched multiple times by user
score (int) – score in 1 to 10 scale
num_watched_episodes (int) – Number of episodes watched by user
priority (int) – Priority level to watch this anime
num_times_rewatched (int) – Number of how many times you’ve re-watched this series, this should not include first time you completed this series
rewatch_value (int) – How likely are you to re-watch this series
tags (str) – Tags you’re willing to give to this series
comments (str) – Additional comments you’d like to leave under this series
- Params datetime.date start_date
Start watching date
- Params datetime.date finish_date
Finish watching date
- Returns
Updated entry
- Return type
-
Client.delete_my_anime_list_status(anime_id)¶ -
Deletes entry from list for given anime
- Params int manga_id
ID number for anime you want to delete
-
Client.get_user_anime_list(username='@me', *, sort=None, status=None, limit=100, offset=0, list_status_fields=True, fields=Fields.from_list(['id', 'title', 'main_picture', 'my_list_status']), nsfw=None)¶ -
Fetches anime list for given user
- Params MyAnimeListSorting sort
Method using which entries will be sorted
- Params str status
Only entries with provided status will be returned
- Params int limit
Number of entries returned
- Params int offset
Position starting from which entries will be fetched
- Params ListStatusFields list_status_fields
Fields returned inside my_list_status field in entry
- Params Fields fields
Fields returned alongside each entry
- Parameters
nsfw (bool) – If set to True results with nsfw grade ‘gray’ and ‘black’ will also be fetched, if omitted it will be inherited from Client class
- Returns
List of objects containing manga information for entries on users’ manga list
- Return type
-
Client.update_my_manga_list_status(manga_id, *, status=None, start_date=None, finish_date=None, is_rereading=None, score=None, num_volumes_read=None, num_chapters_read=None, priority=None, num_times_reread=None, reread_value=None, tags=None, comments=None, **kwargs)¶ -
Updates myanimelist status for a given manga, takes payload as dictionary as argument. Emit fields to not update. Returns updated entry from list.
- Parameters
manga_id (int) – id of manga you want to update
status (Literal["watching", "completed", "on_hold", "dropped", "plan_to_watch"]) – Watching status of series
is_rereading (bool) – Defines if series is read multiple times by user
score (int) – score in 1 to 10 scale
num_volumes_read (int) – Number of volumes read by user
num_chapters_read (int) – Number of chapters read by user
priority (int) – Priority level to watch this anime
num_times_reread (int) – Number of how many times you’ve re-read this series, this should not include first time you completed this series
reread_value (int) – How likely are you to re-read this series
tags (str) – Tags you’re willing to give to this series
comments (str) – Additional comments you’d like to leave under this series
- Params datetime.date start_date
Start reading date
- Params datetime.date finish_date
Finish reading date
- Returns
Updated entry
- Return type
-
Client.delete_my_manga_list_status(manga_id)¶ -
Deletes entry from list for given manga
- Params int manga_id
ID number for manga you want to delete
-
Client.get_user_manga_list(username='@me', *, sort=MyMangaListSorting.LIST_SCORE, status=None, limit=100, offset=0, list_status_fields=True, fields=Fields.from_list(['id', 'title', 'main_picture']), nsfw=None)¶ -
Fetches manga list for given user
- Params MyMangaListSorting sort
Method using which entries will be sorted
- Params str status
Only entries with provided status will be returned
- Params int limit
Number of entries returned
- Params int offset
Position starting from which entries will be fetched
- Params ListStatusFields list_status_fields
Fields returned inside my_list_status field in entry
- Params Fields fields
Fields returned alongside each entry
- Parameters
nsfw (bool) – If set to True results with nsfw grade ‘gray’ and ‘black’ will also be fetched, if omitted it will be inherited from Client class
- Returns
List of objects containing manga information for entries on users manga list
- Return type
Utility¶
-
class
malclient.PagedResult(seq, page_link)¶ -
List of objects with support for fetching previous/next page from MAL
Exceptions¶
-
exception
malclient.APIException(status_code, message, response)¶ -
Base exception for API
-
exception
malclient.BadRequest(response)¶ -
HTTP 400 Bad Request exception
-
exception
malclient.Unauthorized(response)¶ -
HTTP 401 Unauthorized exception
-
exception
malclient.Forbidden(response)¶ -
HTTP 403 Forbidden exception
-
exception
malclient.NotFound(response)¶ -
HTTP 404 Not Found exception