Clients
AniList
AniList(api_url: str = 'https://graphql.anilist.co', retries: PositiveInt = 5, **kwargs: HTTPXClientKwargs)
AniList API client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_url |
str
|
The URL of the AniList API. Default is |
'https://graphql.anilist.co'
|
retries |
PositiveInt
|
Number of times to retry a failed request before raising an error. Default is 5. Set this to 1 to disable retrying. |
5
|
kwargs |
HTTPXClientKwargs
|
Keyword arguments to pass to the underlying httpx.Client() used to make the POST request. |
{}
|
Source code in src/pyanilist/_clients/_sync.py
search
search(title: AniListTitle, season: MediaSeason | None = None, season_year: AniListYear | None = None, type: MediaType | None = None, format: MediaFormat | None = None, status: MediaStatus | None = None) -> Media
Search for media on AniList based on the provided parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
AniListTitle
|
The string used for searching on AniList. |
required |
season |
MediaSeason | None
|
The season the media was initially released in. Default is None. |
None
|
season_year |
AniListYear | None
|
The season year the media was initially released in. Default is None. |
None
|
type |
MediaType | None
|
The type of the media; anime or manga. Default is None. |
None
|
format |
MediaFormat | None
|
The format the media was released in. Default is None. |
None
|
status |
MediaStatus | None
|
The current releasing status of the media. Default is None. |
None
|
Raises:
Type | Description |
---|---|
ValidationError
|
Invalid input |
HTTPStatusError
|
AniList returned a non 2xx response. |
Returns:
Type | Description |
---|---|
Media
|
A Media object representing the retrieved media information. |
Source code in src/pyanilist/_clients/_sync.py
get
Retrieve media information from AniList based on it's ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
int
|
AniList ID of the media as found in the URL: |
required |
Raises:
Type | Description |
---|---|
ValidationError
|
Invalid input |
HTTPStatusError
|
AniList returned a non 2xx response. |
Returns:
Type | Description |
---|---|
Media
|
A Media object representing the retrieved media information. |
Source code in src/pyanilist/_clients/_sync.py
AsyncAniList
AsyncAniList(api_url: str = 'https://graphql.anilist.co', retries: PositiveInt = 5, **kwargs: HTTPXAsyncClientKwargs)
Async AniList API client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_url |
str
|
The URL of the AniList API. Default is |
'https://graphql.anilist.co'
|
retries |
PositiveInt
|
Number of times to retry a failed request before raising an error. Default is 5. Set this to 1 to disable retrying. |
5
|
kwargs |
HTTPXAsyncClientKwargs
|
Keyword arguments to pass to the underlying httpx.AsyncClient() used to make the POST request. |
{}
|
Source code in src/pyanilist/_clients/_async.py
search
async
search(title: AniListTitle, season: MediaSeason | None = None, season_year: AniListYear | None = None, type: MediaType | None = None, format: MediaFormat | None = None, status: MediaStatus | None = None) -> Media
Search for media on AniList based on the provided parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
AniListTitle
|
The string used for searching on AniList. |
required |
season |
MediaSeason | None
|
The season the media was initially released in. Default is None. |
None
|
season_year |
AniListYear | None
|
The season year the media was initially released in. Default is None. |
None
|
type |
MediaType | None
|
The type of the media; anime or manga. Default is None. |
None
|
format |
MediaFormat | None
|
The format the media was released in. Default is None. |
None
|
status |
MediaStatus | None
|
The current releasing status of the media. Default is None. |
None
|
Raises:
Type | Description |
---|---|
ValidationError
|
Invalid input |
HTTPStatusError
|
AniList returned a non 2xx response. |
Returns:
Type | Description |
---|---|
Media
|
A Media object representing the retrieved media information. |
Source code in src/pyanilist/_clients/_async.py
get
async
Retrieve media information from AniList based on it's ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
int
|
AniList ID of the media as found in the URL: |
required |
Raises:
Type | Description |
---|---|
ValidationError
|
Invalid input |
HTTPStatusError
|
AniList returned a non 2xx response. |
Returns:
Type | Description |
---|---|
Media
|
A Media object representing the retrieved media information. |