Skip to main content

Anisearch is the lib for accessing anime or manga from anilist.co on the Python Platform.

Project description

Anisearch

Anilist API module for python. you only need to copy the Anilist folder to your own script.

Executing program

  • How to run the program
  • Import module
from Anisearch import Anilist

instance = Anilist()

From there you can get information from Anilist using their new GraphQL API. To get data on a known ID.

instance.get.anime(13601) # Return data on PSYCHO-PASS 
instance.get.manga(64127) # Return data on Mahouka Koukou no Rettousei
instance.get.staff(113803) # Return data on Kantoku
instance.get.studio(7) # Return data on J.C. Staff

Searching is also making a return.

instance.search.anime("Sword") # Anime search results for Sword.
instance.search.manga("Sword") # Manga search results for Sword.
instance.search.character("Tsutsukakushi") # Character search results for Tsutsukakushi.
instance.search.staff("Kantoku") # Staff search results for Kantoku.
instance.search.studio("J.C. Staff") # Studio search result for J.C. Staff.

A note about the searching and getting:

search(term, page = 1, perpage = 10)
get(item_id)

Pagination is done automatically in the API. By default, you'll get 10 results per page. If you want more, just change the per page value. pageInfo is always the first result in the returned data. Pages start at 1 and if you want another page, just replace page with the next number. query_string is to set what info you want to display.

Customization

You can set your own settings as follows

import logging
from Anisearch import Anilist
# for init instance
SETTINGS = {
    'header': {
        'Content-Type': 'application/json',
        'User-Agent': 'Anisearch (github.com/MeGaNeKoS/Anisearch)',
        'Accept': 'application/json'},
    'api_url': 'https://graphql.anilist.co'
}
request_param = {}  # this is for the requests lib parameters.
instance = Anilist(log_level=logging.INFO, settings = SETTINGS, request_param = request_param)

# for instance get/search parameters
retry = 10
instance.get.anime(13601, num_retries=retry)  # default 10

Todo

  • Add more error handling when the API returns an error.
    • currently is limited to 429 too many requests. You can help me by providing a log when other errors occur.

Change Log

1.0.2 (28/10/2022)

  • Object/Memory optimization
  • Supress any error by returning error message
  • Better retry mechanism
  • Change the default query to match the anilist website

1.0.1 (23/06/2022)

  • Add rate limit(too many request) handler

1.0.0 (31/08/2021)

  • First Release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Anisearch-1.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

Anisearch-1.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file Anisearch-1.1.0.tar.gz.

File metadata

  • Download URL: Anisearch-1.1.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for Anisearch-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e28cd0142130a9b815fff8bbdbd0a1056e7fac5c678c33ebd435b8b243e6da9d
MD5 7ca9b69c2be3a0debb471d96bfb88e61
BLAKE2b-256 ed4a749123759ea5f54f0da4f74f166cb1ab02e9b88056d0a83f3187c8830ef0

See more details on using hashes here.

File details

Details for the file Anisearch-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: Anisearch-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for Anisearch-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e065cc8da9af75b29948756ed0b43e69b349faf2c50656828a5c97d9cd2f08b
MD5 504c1ed1b113d382dd8a952c338cebfb
BLAKE2b-256 aed7476307889b6c9d5adae34a530ef5cd607a6ddf99a65af3c76d8be5259fc6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page