Skip to content
PandeCodePublic

About

My Anime list api client with auth module.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

24 Commits

Folders and files

Repository files navigation

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()

About

My Anime list api client with auth module.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages