Git Product home page Git Product logo

anipy's Introduction

Anipy

Build Status Codacy Badge Codacy Badge Python Version Project License

Anipy is a python library that wraps and organize the Anilist rest api into modules, classes and functions so it can be used quick, easy, and right out of the box. You can take a look at the api official docs. Anilist is a Josh Star's project

Table of contents

Installation

For now the only available versions are alphas. You can Instaled the las by:

$ git clone https://github.com/twissell-/anipy.git
$ cd anipy
$ python setup.py # Be sure using Python 3

Usage

I've tried to keep the developer interface as simple as possible.

Authentication

Before you can access any Anilist resource you have to get authenticated. Once you have created a client you must configure auth.AuthenticationProvider class with your credentials.

Now you can get authenticated with any of the available grant types. Aditionaly, Anipy have a GrantType.refreshToken in case you have saved a refresh token from a previous authentication. Note that only code and pin authentication gives you a refresh token.

from anipy import AuthenticationProvider
from anipy import Authentication
from anipy import GrantType

AuthenticationProvider.config('your-client-id', 'your-client-secret', 'your-redirect-uri')

auth = Authentication.fromCredentials()
# or
auth = Authentication.fromCode('code')
# or
auth = Authentication.fromPin('pin')

# Now you can save the refresh token
refresh_token = auth.refreshToken

auth = Authentication.fromRefreshToken(refresh_token)

Authentication expires after one hour and will refresh automatically, nevertheless you can do it manually at any time, ie.:

if auth.isExpired:
    auth.refresh()

Resources

Resources are one of the most important parts of the library. They are in charge of go an get the data from the Anilist API. Each domain class have a resource, you can compare them to Data Access Objects. All resouces are Singletons.

In order to keep things simple you can access the resource from class it serves

# Current logged user
user = User.resource().principal()
# A user for his Id or Display Name
user = User.resource().byId(3225)
user = User.resource().byDisplayName('demo')

Some resources are injected in other classes also in order to keep things simple (ie. AnimeListResource). So if you want to get de watching list of a user you can do:

# The long way
resource = AnimeListResource()
watching_list = resource.byUserId(user.id)
# Or the short way
watching_list = user.watching

Roadmap

Here is a sumary of the project state.

Next Release: 0.1

  • Authentication
    • Authorization Code
    • Authorization Pin
    • Client Credentials
  • User
    • Basics
  • User Lists
    • Animelist
      • Update watched episodes
      • Update rewatched
      • Update notes
      • Update list status
      • Update score (simple)
      • Create a entry
      • Remove entry
    • Mangalist
    • List Scores types
  • Anime
    • Basics
    • Browse
    • Search
  • Manga
    • Basics
    • Browse
    • Search

Out of Scope

Thing that I'm not going to do soon.

  • Advance rating score
  • Custom lists

anipy's People

Contributors

twissell- avatar

Stargazers

 avatar  avatar Hong-Jia Chen avatar Jeffrey avatar Alex Perathoner avatar Jason GH avatar RememberTheAir avatar David Delgado avatar

Watchers

Youssef Habri avatar  avatar David Delgado avatar Josh Star avatar Kiyoto Kai avatar  avatar

Forkers

syrup zenahr

anipy's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.