Keksik API wrapper
Обвертка над API keksik.io
Использование:
import os
from keksik_api import KeksikAPI, KeksikAPIException
GROUP_ID = int(os.environ.get('GROUP_ID'))
ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN')
api = KeksikAPI(GROUP_ID, ACCESS_TOKEN)
last_donates = await api.donates.get_last()
for item in last_donates.items:
print(item.id)
# Передача токена динамически
await api.donates.answer(1, "Спасибо :3", group=GROUP_ID, token=ACCESS_TOKEN)
# Ошибочки
try:
await api.donates.answer(-666, '')
except KeksikAPIException as exc:
print("Произошла ошибка: ", exc.error_code, exc.message)
# Кастомные запросы
await api.request("{method}", dict(data='...'), raise_errors=False)
# Callback
import uvicorn
from fastapi import FastAPI
from keksik_api.callback import Callback, Router
from keksik_api import schemas
SECRET_KEY = os.environ.get('SECRET_KEY')
CONFIRMATION_CODE = os.environ.get('CONFIRMATION_CODE')
router = Router()
@router.on_new_donate()
async def on_new_donate_handler(event: schemas.DonateEvent):
print("New donate", event.donate.id)
callback = Callback(
KeksikAPI(GROUP_ID, ACCESS_TOKEN),
SECRET_KEY,
CONFIRMATION_CODE,
router=router
)
app = FastAPI()
@app.post("/")
async def app_route(params: dict):
return await callback.route_web_request(params)
if __name__ == "__main__":
uvicorn.run(app)
Metadata
Release files for keksik-api 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| keksik_api-0.2.5.tar.gz | 27.2 kB | Without provenance | Details for keksik_api-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| keksik_api-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for keksik_api-0.2.5-py3-none-any.whl |
Total release size: 43.9 kB
Release files / keksik_api-0.2.5.tar.gz
| Download URL | keksik_api-0.2.5.tar.gz |
|---|---|
| Size | 27.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b13a9e60f7c6cbeeebb1282e8e6fc5dc052c83aa0019105e74e455095fd29d4e
|
|
BLAKE2b-256 checksum How to use checksums |
a775c62d6f781720a1b6f8cfb07a481f722a80e286d2ed660dd00db6e4c62efa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.4 Linux/6.2.0-33-generic
|
Release files / keksik_api-0.2.5-py3-none-any.whl
| Download URL | keksik_api-0.2.5-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1dc94d2c47e70efc55c7707a9d3cb4f8f749bd5dbfad21e97fe473c845236647
|
|
BLAKE2b-256 checksum How to use checksums |
bdf3e96b2d2aed495ffc29d8de9f83055bead4ef1d982038058252f46373e0db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.4 Linux/6.2.0-33-generic
|
Security for keksik-api 0.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.