A simple async Python wrapper for nekos.best API.
Project description
nekos-best.py
A simple async Python wrapper for nekos.best API.
Join the official Discord server here.
Requirements
- aiohttp (>=3.6.2)
Installation
Make sure to have pip installed in your environement. It will also install all requirements.
pip install -U nekosbest
Example
import asyncio
from typing import Union
from nekosbest import Client, Result
client = Client()
async def get_img(type: str, amount: int = 1) -> Union[Result, list[Result]]:
result = await client.get_image(type, amount)
print(result)
loop = asyncio.get_event_loop()
loop.run_until_complete(get_img("nekos"))
# <Result url=https://nekos.best/api/v1/nekos/0356.jpg artist_href=https://www.pixiv.net/en/users/38378485 artist_name=奥馬 source_url=https://www.pixiv.net/en/artworks/88188062>
loop.run_until_complete(get_img("nekos", 2))
# [<Result url=https://nekos.best/api/v1/nekos/0072.jpg artist_href=https://www.pixiv.net/en/users/12191 artist_name=こみやひとま source_url=https://www.pixiv.net/en/artworks/66834141>, <Result url=https://nekos.best/api/v1/nekos/0215.jpg artist_href=https://www.pixiv.net/en/users/3684923 artist_name=ひゅらさん source_url=https://www.pixiv.net/en/artworks/79697176>]
Breaking changes
Migrate from 0.x.x to 1.0.0
Client.teardown
has been removed, it is no longer needed to pass it when closing.
Migrate from 1.0.20 to 1.1.0
nekosbest.Result.source_details
has been removed. Source details are now in Result
.
And therefore, nekosbest.Results
and nekosbest.SourceDetails
got removed too.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nekosbest-1.1.6.tar.gz
(16.3 kB
view hashes)
Built Distribution
nekosbest-1.1.6-py3-none-any.whl
(19.7 kB
view hashes)
Close
Hashes for nekosbest-1.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c8e1533b9024f26486cabd6669906f34d4c0c38f225a40ad2bf49fcc285b5e7 |
|
MD5 | 7dbfed2b8b53c11cf8c98972ae9d271b |
|
BLAKE2b-256 | 2d93f7540b24f9a0cad1ddc3cc7625311a8c9ba096bcdbc37f87e91e09dbac24 |