Python wrapper for shikimori API
Project description
pyshikiapi
Python wrapper for shikimori API
Install
pip install pyshikiapi
Usage
from pyshikiapi import API
app_name = 'YOUR_APP_NAME'
client_id = 'YOUR_APP_CLIENT_ID'
client_secret = 'YOUR_APP_SECRET'
api = API(app_name, client_id, client_secret)
print('Please visit the link and copy authorization code:', api.authorization_url)
code = input('The code: ')
api.fetch_token(code)
# Now you can use the api object to send requests
If you want to save the token to use it later, pass the token_update_callback
argument to API:
def token_file_saver(token): # A function which accepts 1 dict-like argument
with open('token.json', 'w') as f:
json.dump(token, f)
api = API(app_name, client_id, client_secret, token_update_callback=token_file_saver)
Next time you start, load the token:
with open('token.json') as f:
token = json.load(f)
api = API(app_name, client_id, client_secret, token)
Examples
api.animes.GET(page=2, limit=10) # will send GET-request animes?page=2&limit=10
api.animes(5).roles.GET() # will send GET-request animes/5/roles
comment = {'body': 'hello', 'commentable_type': 'User', 'commentable_id': 4193}
api.comments.POST(comment=comment, broadcast=False)
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
pyshikiapi-1.0.2.tar.gz
(7.4 kB
view details)
Built Distribution
File details
Details for the file pyshikiapi-1.0.2.tar.gz
.
File metadata
- Download URL: pyshikiapi-1.0.2.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aaf06217a1ccaf7adcf4d7fd5015538c8e520924144069b3c229bc8db2279d58 |
|
MD5 | 128afdafaef6510ad0dcd695595a94cb |
|
BLAKE2b-256 | 817b8d8b09fe27b89e806fcc83fe33e6de65831acb1e22ec6d2f331242f2d96f |
File details
Details for the file pyshikiapi-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: pyshikiapi-1.0.2-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 535ab9da1803ed213d477a6b10fc4a1950eade0332827ade213080a69750d7a1 |
|
MD5 | 263e7cbac6532c35f32d761c7e5354b3 |
|
BLAKE2b-256 | 05d2ddaf8f958c91c8377cfea3ae365c3c5d2b19b117e912e3acdd3c1a56dda2 |