A asynchronous/synchronous python wrapper for the Donatello API.
Project description
✨ Features
- Full type hints
- Client info
- Get donates
- Get clients
- Long polling
- Async support
🔗 Installation
pip install donatello-py
For speedup:
pip install donatello-py[speed]
🧑🏭 Basic Usage
Get and activate your API key here.
⛓️ Sync
from donatello import Donatello
client = Donatello("YOUR_API_KEY")
# Get client info
print(client.get_me())
# Get donates
print(client.get_donates(page=0, per_page=00))
# Get clients
print(client.get_clients())
⛓️ Async
from donatello import AsyncDonatello
client = AsyncDonatello("YOUR_API_KEY")
async def main():
print(await client.get_me())
print(await client.get_donates(page=0, per_page=00))
print(await client.get_clients())
asyncio.run(main())
🥏 Long polling
For use long polling you need to create widget here and get widget id from url.
Example url:
https://donatello.to/widget/<WIDGET_ID>/token/<YOUR_API_KEY>
Code example
⛓️ Sync
from donatello import Donatello
from donatello.models import Donate, User
client = Donatello("YOUR_API_KEY", "WIDGET_ID")
@client.on_ready
def start(user: User):
print(f"Started with user {user.nickname}")
print(f"Donates Amount: {user.donates.total_amount}")
print(f"Donates count: {user.donates.total_count}")
@client.on_donate
def donate(donate: Donate):
print(donate)
client.start()
⛓️ Async
from donatello import AsyncDonatello
from donatello.models import Donate, User
client = AsyncDonatello("YOUR_API_KEY", "WIDGET_ID")
@client.on_donate
async def donate(donate):
print(f"Donator: {donate.nickname}")
print(f"Amount: {donate.amount} {donate.currency} / {donate.goal_amount} {donate.goal_currency}")
print(f"Message: {donate.message}")
@client.on_ready
async def ready(user):
print(user)
client.start()
📚 Docs
You can find docs here.
📝 Examples
You can find more examples here.
📄 License
📋 TODO
-
Add more examples
-
Add docs
-
Add tests
-
Websocket based long polling
-
Goal, Top, interactive widgets?Never
🤝 Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
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
donatello-py-1.0.2.tar.gz
(9.2 kB
view details)
Built Distribution
File details
Details for the file donatello-py-1.0.2.tar.gz
.
File metadata
- Download URL: donatello-py-1.0.2.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 690530f9dd833122614e12b41f97663033e4b9421a1ca757e25a8a94f0ee98a8 |
|
MD5 | 9195678a82dfda45b39525cf32d70790 |
|
BLAKE2b-256 | bcc1aff5286aba1607085b36c6b95b32e798ac76c6871dff40e9a4f5167314b1 |
File details
Details for the file donatello_py-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: donatello_py-1.0.2-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 486fc419befe5b5bcabfd85521dd1019aa6e2ebea14a3d68e1e81f309c2509c0 |
|
MD5 | a459f6ef7b8dfc94815c8786ae3dc2ec |
|
BLAKE2b-256 | c20c2bc608ec2cc26c786455be69d682a0d71dfc5a090919f7247990c407903c |