Python client for the https://nekos.moe/ API
Project description
PyNekos provides a simple and pythonic way to use the Nekos.moe API.
The full documentation for PyNekos can be found here.
Setup
Some functionalities of the API needs authentication, used for post images and regenerate and get token. This way, if you pretend to use this functionalities, you’ll need to sign up for a (free) account that authorizes access to the Nekos.moe API. If you pretend to use only the simple functionalities (like get images informations, user informations, search for images, etc), you don’t even need to instance an object of the Neko class.
Installation
PyNekos requires Python 3.
Use pip to install the package from PyPI:
pip install PyNekos
Usage
Import the package and initiate the Neko class:
from PyNekos.nekosapi import Neko
nyan = Neko()
If you pretend to use more advanced functionalities of the API, you’ll need the token. To get the token, you’ll need your credentials:
from PyNekos.nekosapi import Neko
nyan = Neko(username='myuser', password='iwillnotshowyouthis')
token = nyan.get_token()
print(token)
After that, instance the object again with the token:
from PyNekos.nekosapi import Neko
nyan = Neko(token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
Examples
Getting a random image:
from PyNekos.nekosapi import Neko
random_json = Neko.random_image()
print(random_json)
Getting the link of the image ID and downloading the image:
from PyNekos.nekosapi import Neko
image_down = Neko.get_link('Sy9sHFa8X', down=True)
print(image_down)
You can see the usage of all endpoints of the API in the example files.
Contributing
Please contribute! If you want to fix a bug, suggest improvements, or add new features to the project, just open an issue or send a pull request.
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
File details
Details for the file PyNekos-1.41.tar.gz
.
File metadata
- Download URL: PyNekos-1.41.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 550ac18db9389e9f217d35703bd02b1d83f6bb82a6cfacd8ea286899a7d031af |
|
MD5 | a8e9fd8f4a11f592cb5f53e4654624ea |
|
BLAKE2b-256 | 135e923c22effdb23fb28d8469723ddadaa58a676b976bcd7bec25444f502931 |