Client
AniList
AniList(
api_url: str = "https://graphql.anilist.co",
*,
client: Client | None = None,
)
AniList API client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_url
|
str
|
The URL of the AniList API. |
'https://graphql.anilist.co'
|
client
|
Client | None
|
An |
None
|
Source code in src/pyanilist/_client.py
close
get_airing_schedule
get_airing_schedule(
media: MediaID, *, not_yet_aired: bool | None = None
) -> Iterator[AiringSchedule]
Retrieve the airing schedule for a given Media
object or ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
media
|
MediaID
|
The media to get the airing schedule for. Can be an ID ( |
required |
not_yet_aired
|
bool | None
|
Filter results to include only episodes that have not yet aired ( |
None
|
Yields:
Type | Description |
---|---|
AiringSchedule
|
An object representing the retrieved airing schedule. |
Raises:
Type | Description |
---|---|
MediaNotFoundError
|
If the provided media ID or URL does not correspond to any existing media on AniList. |
RateLimitError
|
If the API rate limit is exceeded. The error contains information on how long to wait before retrying. |
AnilistError
|
If any other error occurs during the API request. |
Source code in src/pyanilist/_client.py
get_characters
get_characters(
media: MediaID,
*,
sort: SortType[CharacterSort] | None = None,
role: CharacterRole | None = None,
) -> Iterator[Character]
Retrieve characters associated with a given Media
object or ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
media
|
MediaID
|
The media to get characters for. Can be an ID ( |
required |
sort
|
SortType[CharacterSort]
|
Sorting criteria for the characters.
Can be an instance of |
None
|
role
|
CharacterRole | None
|
Filter characters by their role in the media. If |
None
|
Yields:
Type | Description |
---|---|
Character
|
An object representing the retrieved character. |
Raises:
Type | Description |
---|---|
MediaNotFoundError
|
If the provided media ID or URL does not correspond to any existing media on AniList. |
RateLimitError
|
If the API rate limit is exceeded. The error contains information on how long to wait before retrying. |
AnilistError
|
If any other error occurs during the API request. |
Source code in src/pyanilist/_client.py
get_media
get_media(
search: str | None = None,
**kwargs: Unpack[MediaQueryParams],
) -> Media
Retrieve a single media object from AniList based on the provided query parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search
|
str | None
|
Search term to include in the query. |
None
|
**kwargs
|
Unpack[MediaQueryParams]
|
Additional query parameters. See |
{}
|
Raises:
Type | Description |
---|---|
MediaNotFoundError
|
If no media matches the provided query parameters on AniList. |
InvalidMediaQueryError
|
If the query parameters are missing, empty, or contain unexpected keys. |
RateLimitError
|
If the API rate limit is exceeded. The error contains information on how long to wait before retrying. |
AnilistError
|
If any other error occurs during the API request. |
Returns:
Type | Description |
---|---|
Media
|
An object representing the retrieved media. |
Source code in src/pyanilist/_client.py
get_media_many
get_media_many(
search: str | None = None,
**kwargs: Unpack[MediaQueryParams],
) -> Iterator[Media]
Retrieve all matching media from AniList as an iterator based on the provided query parameters.
Unlike AniList.get_media
,
this method does not raise a MediaNotFoundError
if no results are found; the iterator will simply be empty.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search
|
str | None
|
Search term to include in the query. |
None
|
**kwargs
|
Unpack[MediaQueryParams]
|
Additional query parameters. See |
{}
|
Raises:
Type | Description |
---|---|
InvalidMediaQueryError
|
If the query parameters are missing, empty, or contain unexpected keys. |
RateLimitError
|
If the API rate limit is exceeded. The error contains information on how long to wait before retrying. |
AnilistError
|
If any other error occurs during the API request. |
Yields:
Type | Description |
---|---|
Media
|
Each matching media object retrieved from AniList. |
Source code in src/pyanilist/_client.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
get_recommendations
get_recommendations(
media: MediaID,
*,
sort: SortType[RecommendationSort] | None = None,
) -> Iterator[RecommendedMedia]
Retrieve recommended media based on a given Media
object or ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
media
|
MediaID
|
The media to get recommendations for. Can be an ID ( |
required |
sort
|
SortType[RecommendationSort]
|
Sorting criteria for the recommendations.
Can be an instance of |
None
|
Yields:
Type | Description |
---|---|
RecommendedMedia
|
An object representing the retrieved recommended media. |
Raises:
Type | Description |
---|---|
MediaNotFoundError
|
If the provided media ID or URL does not correspond to any existing media on AniList. |
RateLimitError
|
If the API rate limit is exceeded. The error contains information on how long to wait before retrying. |
AnilistError
|
If any other error occurs during the API request. |
Source code in src/pyanilist/_client.py
get_relations
get_relations(media: MediaID) -> Iterator[RelatedMedia]
Retrieve related media based on a given Media
object or ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
media
|
MediaID
|
The media to get related media for. Can be an ID ( |
required |
Yields:
Type | Description |
---|---|
RelatedMedia
|
An object representing the retrieved related media. |
Raises:
Type | Description |
---|---|
MediaNotFoundError
|
If the provided media ID or URL does not correspond to any existing media on AniList. |
RateLimitError
|
If the API rate limit is exceeded. The error contains information on how long to wait before retrying. |
AnilistError
|
If any other error occurs during the API request. |
Source code in src/pyanilist/_client.py
get_staffs
Retrieve staff members based on a given Media
object or ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
media
|
MediaID
|
The media to get staff for. Can be an ID ( |
required |
sort
|
SortType[StaffSort]
|
Sorting criteria for the staff.
Can be an instance of |
None
|
Yields:
Type | Description |
---|---|
Staff
|
An object representing the retrieved staff member. |
Raises:
Type | Description |
---|---|
MediaNotFoundError
|
If the provided media ID or URL does not correspond to any existing media on AniList. |
RateLimitError
|
If the API rate limit is exceeded. The error contains information on how long to wait before retrying. |
AnilistError
|
If any other error occurs during the API request. |
Source code in src/pyanilist/_client.py
get_studios
get_studios(
media: MediaID,
*,
sort: SortType[StudioSort] | None = None,
is_main: bool | None = None,
) -> Iterator[Studio]
Retrieve studios based on a given Media
object or ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
media
|
MediaID
|
The media to get studios for. Can be an ID ( |
required |
sort
|
SortType[StudioSort]
|
Sorting criteria for the studios.
Can be an instance of |
None
|
is_main
|
bool | None
|
Filter for the main studios ( |
None
|
Yields:
Type | Description |
---|---|
Studio
|
An object representing the retrieved studio. |
Raises:
Type | Description |
---|---|
MediaNotFoundError
|
If the provided media ID or URL does not correspond to any existing media on AniList. |
RateLimitError
|
If the API rate limit is exceeded. The error contains information on how long to wait before retrying. |
AnilistError
|
If any other error occurs during the API request. |