DiakaPlug Library
The DiakaPlug is a Python library that provides a set of tools for interacting with the Diaka donation service. It allows you to send test notifications and parse incoming notifications from Diaka streams. This README.md file offers an overview of the library and its main features.
Translation of README.md into Ukrainian.
Table of Contents
Installation
To use the Diakaplug library, you'll need to install it via pip:
pip install diakaplug
Usage
Synchronous Diaka Class
The Diaka class provides synchronous methods for interacting with the Diaka service.
Initialization
from diakaplug import Diaka
# Initialize the Diaka class with a Diaka notification URL
diaka = Diaka("https://c.diaka.ua/notification_url")
Sending a Test Notification
# Send a test notification with optional parameters
status_code = diaka.send_test_notification(
target="TargetName",
amount=54,
name="DiakaPlug",
message="Hi from Python",
source="SourceName",
show="Show",
additional="AdditionalInfo"
)
Parsing a Notification
# Parse a notification using a transaction ID and hash
notification_data = diaka.parse_notification(transaction_id=123, hash="notification_hash")
Get Last Donations
# Get last donations with optional parameters
last_donations = diaka.get_last_donations(limit=10, test=2)
Get Largest Donations
# Get largest donations with optional parameters
largest_donations = diaka.get_largest_donations(offset=86400, limit=10, test=2)
Get Amount of Donations
# Get amount of donations with optional parameters
amount_of_donations = diaka.get_amount_of_donations(offset=86400, test=2)
Establishing a Session
# Establish a session with the SSE server and yield parsed notifications
for notification in diaka.session():
print(notification)
Asynchronous AsyncDiaka Class
The AsyncDiaka class provides asynchronous methods for interacting with the Diaka service.
Initialization
from diakaplug import AsyncDiaka
# Initialize the AsyncDiaka class with a Diaka notification URL
async_diaka = AsyncDiaka("https://c.diaka.ua/notification_url")
Sending a Test Notification
# Send a test notification with optional parameters
status_code = await async_diaka.send_test_notification(
target="TargetName",
amount=54,
name="DiakaPlug",
message="Hi from Python",
source="SourceName",
show="ShowName",
additional="AdditionalInfo"
)
Parsing a Notification
# Parse a notification using a transaction ID and hash
notification_data = await async_diaka.parse_notification(transaction_id=123, hash="notification_hash")
Get Last Donations
# Get last donations with optional parameters
last_donations = diaka.get_last_donations(limit=10, test=2)
Get Largest Donations
# Get largest donations with optional parameters
largest_donations = diaka.get_largest_donations(offset=86400, limit=10, test=2)
Get Amount of Donations
# Get amount of donations with optional parameters
amount_of_donations = diaka.get_amount_of_donations(offset=86400, test=2)
Establishing a Session
# Establish a session with the SSE server and yield parsed notifications
async for notification in async_diaka.session():
print(notification)
License
This project is licensed under the MIT License.
Metadata
Release files for diakaplug 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| diakaplug-0.0.3.tar.gz | 5.1 kB | Details |
Release files / diakaplug-0.0.3.tar.gz
| Download URL | diakaplug-0.0.3.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cde99d14ccbd09de61f1513dc5b9507b1b243c185f8564d1f51f47ab00d0ffb0
|
|
BLAKE2b-256 checksum How to use checksums |
97dfb629863ccc5d903bec836c7be4d6630abc87107a5ba1eb377ff610c18c89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|