Asynchronous API wrapper for Sankaku Complex.
Project description
sankaku
For real men of culture
About
Asynchronous API wrapper for Sankaku Complex with type-hinting, pydantic data validation and an optional logging support with loguru.
Features
- Type-hints
- Deserialization of raw json data thanks to pydantic models
- Enumerations for API request parameters to provide better user experience
Useful links
Requirements
- Python 3.8+
- aiohttp
- pydantic
- loguru
- aiohttp-retry
- typing_extensions; python_version < '3.10'
Installation
Installation with pip
To install sankaku via pip write following line of code in your terminal:
pip install sankaku
Installation with Docker
To install the sankaku via Docker, you can follow these steps:
Step 1: Install Docker
Ensure that Docker is installed on your machine. If Docker is not already installed, you can download and install it from the official Docker website.
Step 2: Use docker to install sankaku
Open a command prompt. Navigate to the directory where you want to install sankaku. Type the following command:
git clone https://github.com/zerex290/sankaku.git
cd sankaku
docker run -it --name sankaku -w /opt -v$(pwd):/opt python:3 bash
Usage example
It's very simple to use and doesn't require to always keep opened browser page with documentation because all methods are self-explanatory:
import asyncio
from sankaku import SankakuClient
async def main():
client = SankakuClient()
post = await client.get_post(25742064)
print(f"Rating: {post.rating} | Created: {post.created_at}")
# "Rating: Rating.QUESTIONABLE | Created: 2021-08-01 23:18:52+03:00"
await client.login(access_token="token")
# Or you can authorize by credentials:
# await client.login(login="nickname or email", password="password")
# Get the first 100 posts which have been added to favorites of the
# currently logged-in user:
async for post in client.get_favorited_posts(100):
print(post)
# Get every 3rd book from book pages, starting with 100th and ending with
# 400th book:
async for book in client.browse_books(100, 401, 3): # range specified in
print(book) # same way as with 'range()'
asyncio.run(main())
Contributing
Feel free to contribute to sankaku after reading CONTRIBUTING file.
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
Built Distribution
File details
Details for the file sankaku-2.0.1.tar.gz
.
File metadata
- Download URL: sankaku-2.0.1.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8f91c86a780e463f1b08fc4caff06b223b72aa449c10660b0627bcb809e03f1 |
|
MD5 | 7c9edc8ec200e7bb5b0d5a3184292b54 |
|
BLAKE2b-256 | ef59bc6ceb82574e42ee17d764b9d808bb25645349dcd5bd15a0b03c3bd51972 |
File details
Details for the file sankaku-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: sankaku-2.0.1-py3-none-any.whl
- Upload date:
- Size: 24.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c49edce5bd8e2cf0b1a56eec125187d3670cc8114760ae996d04ea7d738ab53 |
|
MD5 | 7f29c743d22a7ba991a5927b437fd77c |
|
BLAKE2b-256 | 47812d7d76ddd2ff93d5d1a834223cc72a0d0e53128ec2af8414ea1207abfc87 |