Skip to main content

Shikimori API Wrapper

A Python library that provides a simple and easy-to-use wrapper for accessing the Shikimori API. The library supports all endpoints and types of the Shikimori API and provides OAuth2 authorization functionality using an access token.

Build Status License Coverage Status Documentation Status

Features

  • Support for all Shikimori API endpoints: This library supports all endpoints (both v1 and v2) of the Shikimori API, including anime, manga, characters, users, and more.
  • Authorization support: The library provides support for authorization using an access token.
  • Strong typing: The library has type hints for all methods, making it easy to integrate with other projects.
  • Easy-to-use API: The API wrapper is designed to be simple and easy to use, with intuitive methods and parameters that make it easy to get started quickly.

Documentation

See the shiki.py API documentation .

See the official documentation for the Shikimori API.

Installation

pip

$ pip install shiki.py

poetry

$ poetry add shiki.py

Usage

To use the library, simply import it into your project and create an instance of a Shikimori. You can then use the various methods provided by the Shikimori to access the Shikimori API.

import asyncio

from shikimori.client import Shikimori

client = Shikimori(user_agent="USER_AGENT")

async def main():
    return await client.anime.list()

if __name__ == "__main__":
    asyncio.run(main())

Authorization

For more additional information see the Official Shikimori OAuth2 Guide.

  1. Register your Shikimori Application: This will provide you with a client_id and client_secret that you will need to use OAuth2.

  2. Redirect user to the Shikimori authorization endpoint: This endpoint will prompt the user to grant your application access to their resources. After the user grants access, Shikimori will redirect them back to your application with an authorization code.

https://shikimori.one/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=
  1. Get an access token: Your application will need to exchange an authorization code for an AccessToken. Shikimori will respond with an access token that your application can use to access the restricted resources/endpoints.
import asyncio

from shikimori.client import Shikimori

client = Shikimori(user_agent="USER_AGENT")

async def main():
    return await client.auth.get_access_token("CODE")

if __name__ == "__main__":
    asyncio.run(main())
  1. Use access token to access protected resources: Finally, your application can use the access token to access the user's protected resources. Be sure to handle any errors or expired tokens gracefully.
import asyncio

from shikimori.client import Shikimori

client = Shikimori(user_agent="USER_AGENT")


async def main():
    client.set_token("CODE")
    return await client.userRate.increment("USER_RATE_ID")


if __name__ == "__main__":
    asyncio.run(main())

5.Refresh access token: Access tokens have a limited lifespan of 1 day, so your application will need to refresh them periodically to maintain access to the user's resources. To do this use a get_access_token function with the refresh token. Shikimori will respond with a new access token and refresh token that your application can use to continue accessing the user's resources.

import asyncio

from shikimori.client import Shikimori

client = Shikimori(user_agent="USER_AGENT")


async def main():
    return await client.auth.refresh("REFRESH_TOKEN")


if __name__ == "__main__":
    asyncio.run(main())

Contribution

Contributions to this library are always welcome and highly encouraged.

License

This library is licensed under MIT. Please see LICENSE for licensing details.

Metadata

Release files for shiki.py 1.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shiki.py 1.1.5
File Size Uploaded
shiki_py-1.1.5.tar.gz 31.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shiki.py 1.1.5
File Interpreter ABI Platform
shiki.py-1.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 95.2 kB

Release files / shiki_py-1.1.5.tar.gz

Download URL shiki_py-1.1.5.tar.gz
Size 31.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5d068a20aa6114dbf9ed1f36007c7236334f1d5cf16ee0b4e8e803971b05d4ee
BLAKE2b-256 checksum
How to use checksums
32f8647dbe3970b77487a556401fdc3ce06daf18dea137061aea45479bc4fc8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release files / shiki.py-1.1.5-py3-none-any.whl

Download URL shiki.py-1.1.5-py3-none-any.whl
Size 63.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f345a62ab6ac1b17c85454b73ed7b266d847d2a175a9dd6b075f9f2ee76ed66
BLAKE2b-256 checksum
How to use checksums
a0e69713e1c05c983aec1f43218dc58b547ab5e466acc763699c0645686bcdc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release history Release notifications | RSS feed

This release

1.1.5 This release

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.0.2

3 release files

1.0.1

2 release files

1.0.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page