https://github.com/amanoteam/python-anilist
A simple Python 3 library for Anilist.
https://github.com/amanoteam/python-anilist
anilist async asyncio graphql-client python-anilist sync wrapper
Last synced: 7 months ago
JSON representation
A simple Python 3 library for Anilist.
- Host: GitHub
- URL: https://github.com/amanoteam/python-anilist
- Owner: AmanoTeam
- License: mit
- Created: 2021-03-08T17:41:54.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-04T01:27:54.000Z (9 months ago)
- Last Synced: 2025-03-18T05:34:39.410Z (7 months ago)
- Topics: anilist, async, asyncio, graphql-client, python-anilist, sync, wrapper
- Language: Python
- Homepage:
- Size: 158 KB
- Stars: 18
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# python-anilist
[](https://github.com/AmanoTeam/python-anilist/raw/main/LICENSE)


[](https://github.com/AmanoTeam/python-anilist/graphs/contributors)
[](https://pypi.org/project/python-anilist/)> A simple wrapper with full support for `asyncio` made in `Python 3` for [Anilist](//anilist.co) using [httpx](//github.com/encode/httpx).
## Requirements
- Python 3.8 or higher.
- httpx 0.14 or higher.## Installation
**NOTE:** If `python3` is "not a recognized command" try using `python` instead.
For the latest stable version:
```sh
python3 -m pip install python-anilist
```For the latest development version:
```sh
python3 -m pip install git+https://github.com/AmanoTeam/python-anilist.git#egg=python-anilist
```## Basic starting guide
First, import the module
```py
import anilist
```Next, define the client to interact with the API
```py
client = anilist.Client()
```You can search for the name of something on the site using:
- `client.search_user(name, limit=10)`
- `client.search_anime(name, limit=10)`
- `client.search_manga(name, limit=10)`
- `client.search_character(name, limit=10)`
- `client.search_staff(name, limit=10)`If you know the ID of something, then use the get() commands instead:
- `client.get_user(ID)`
- `client.get_anime(ID)`
etc.Example code usage:
```py
import anilistclient = anilist.Client()
# a search returns a tuple (A, B) with A being the main data of the search,
# and B being a PageInfo object containing info about the page of the search result
search_result: tuple[list, PageInfo] = client.search_anime("madoka", limit=10)madoka_list: list[Anime] = search_result[0] # taking "A" from the above tuple, this is a list of "Anime" objects
madoka_magica: Anime = madoka_list[0] # this chooses the first anime in the list of search results
print(madoka.title, madoka.id) # print that anime's title and anilist.co ID
>>> {'romaji': 'Mahou Shoujo Madoka☆Magica', 'english': 'Puella Magi Madoka Magica', 'native': '魔法少女まどか☆マギカ'} 9756
```
## What's left to do?- Write the API Documentation.
- Show some examples.## Credits
* [AnilistPy](//github.com/anilistpy/anilistpy): for inspiration.
## License
Copyright © 2021-2023 [AmanoTeam](https://github.com/AmanoTeam)
and the python-anilist contributorsLicensed under the [Expat/MIT license](LICENSE).
This project is also [REUSE compliant](https://reuse.software/).
See individual files for more copyright information.