Skip to main content

Modified and rewritten using modern models version of James Fotherby malclient

Project description

MAL-API-Client-Upgraded

PyPI PyPI - Python Version PyPI - License
Read the Docs PyPI - Downloads
A third party object-oriented python3 client library for MyAnimeList's official REST API. Originally created by @JFryy, dropped around 2 years ago, picked up and rewritten by ModerNews to fit more modern standards and new REST API functions.

Documentation

Unsure what to do? Check out our documentation
There will be quick guide coming up soon as well!

Installation

Python 3.9 or newer required, this is due to changes in type hinting guidelines, for more info regarding this issue read PEP 585
Install the latest stable version from PyPI
pip install malclient-upgraded

Or current unstable version directly from GitHub:
pip install git+https://github.com/ModerNews/MAL-API-Client-Upgraded

Authentication

Client library uses OAuth2 authorization, all you need to do is register your app here. Main auth requires access token:

import malclient

malclient.client(access_token=token)

Alternatively can authenticate using your client ID

import malclient

malclient.client(client_id=id)

You can generate token old-fashioned way using this tutorial
Or you can use function implemented in API

import malclient

print(malclient.generate_token("<YOUR_CLIENT_ID>", "<YOUR_CLIENT_SECRET>"))

Although remember to call it only once and, then use the token generated this way, optionally with Client.refresh_bearer_token method

As mentioned previously, if you're scared that your token will time out you can also utilize Client.refresh_bearer_token function

client.refresh_bearer_token(
          client_id="<your-client-id>",
          client_secret="<your-client-secret>",
          refresh_token="<your-refresh-token>")

For any other issues regarding authentication, please refer to the following guide.

Quick Start Examples

I contained some examples of usage of this wrapper, note that all responses are converted to python objects using pydantic

import malclient

# nsfw filter is enabled by default, although it's recommended to disable it if your results are missing titles, 
#  you can also enable/disable it for every query individually 
client = malclient.Client(access_token="<your-access-token>", nsfw=True)

# search anime, returns list
anime = client.search_anime("cowboy", limit=20)
for item in anime:
    # prints only titles
    print(item)
    # prints all attributes of object
    print(repr(item))
    
# search anime, returns list
manga = client.search_manga("Monogatari", limit=20)
for item in manga:
    # prints only titles
    print(manga)
    # prints all attributes of object
    print(repr(manga))

# Get individual anime by ID
anime = client.get_anime_details(1)
print(anime)
print(repr(anime))

# Update anime List based off of search results
anime = client.search_anime("Monogatari", limit=1)

Most Imoprtant To-Do's

  • Rewrite boards (currently disabled)
  • Implement additional search endpoint

Useful resources

P.S.

If anything bugs you, you can always reach me out at discord Gruzin#0911 as well

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

malclient-upgraded-1.3.3.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

malclient_upgraded-1.3.3-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file malclient-upgraded-1.3.3.tar.gz.

File metadata

  • Download URL: malclient-upgraded-1.3.3.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for malclient-upgraded-1.3.3.tar.gz
Algorithm Hash digest
SHA256 c924155ab089cb457e9ead72eb016b73086d529c173b4df7b53164111f8b2739
MD5 49250f75aa9e6344266c4cf974213b1a
BLAKE2b-256 f8027fd38c6db152b149ecc1bb3423be9bfab77d6c6261479aab9a9d2ca5c5e2

See more details on using hashes here.

File details

Details for the file malclient_upgraded-1.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for malclient_upgraded-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c40a1ec3a5bc7e40fdf27c982e4ce131ee6b0c4b05e78b6a280a0c1c073d4398
MD5 674238a5d8ac503858bad7b9d1efefe7
BLAKE2b-256 d3ec846b18a12d1437e16d686c8867465bb789f41320b9000b914cdd82c15595

See more details on using hashes here.

Supported by

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