Skip to main content

My Anime List Api Client and Auth.

Project description

MalApi

Instructions

Example

#!/bin/env python3
from pprint import pprint
from pathlib import Path

from mal_api.client import Client
from mal_api.auth import Auth

MAL_CLIENT_ID     = "MAL_CLIENT_ID"
MAL_CLIENT_SECRET = "MAL_CLIENT_SECRECT"
MAL_REDIRECT_URI  = "http://127.0.0.1:8000/callback"

def main():
	if not MAL_CLIENT_ID or not MAL_CLIENT_SECRET or not MAL_REDIRECT_URI:
		raise Exception("Environment Variables not loaded")

	auth = Auth(
			clientId=MAL_CLIENT_ID,
			clientSecret=MAL_CLIENT_SECRET,
			redirectUri=MAL_REDIRECT_URI,
			cacheFile=Path.joinpath(Path.home(), ".cache/malCache.json"),
	)

	auth.authenticate()

	client = Client(auth=auth)

	pprint(client.getUserData())
	pprint(client.getUserAnimeList())

if __name__ == "__main__":
	main()

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

myanimelist-api-0.1.3.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

myanimelist_api-0.1.3-py3-none-any.whl (8.0 kB view hashes)

Uploaded Python 3

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