# 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](https://github.com/d3kxrma/diakaplug/blob/main/README_UK.md).
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Synchronous Diaka Class](#synchronous-diaka-class)
- [Asynchronous AsyncDiaka Class](#asynchronous-asyncdiaka-class)
- [License](#license)
## Installation
To use the Diakaplug library, you'll need to install it via pip:
```bash
pip install diakaplug
```
## Usage
### Synchronous Diaka Class
The `Diaka` class provides synchronous methods for interacting with the Diaka service.
#### Initialization
```python
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
```python
# 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
```python
# Parse a notification using a transaction ID and hash
notification_data = diaka.parse_notification(transaction_id=123, hash="notification_hash")
```
### Get Last Donations
```python
# Get last donations with optional parameters
last_donations = diaka.get_last_donations(limit=10, test=2)
```
### Get Largest Donations
```python
# Get largest donations with optional parameters
largest_donations = diaka.get_largest_donations(offset=86400, limit=10, test=2)
```
### Get Amount of Donations
```python
# Get amount of donations with optional parameters
amount_of_donations = diaka.get_amount_of_donations(offset=86400, test=2)
```
### Establishing a Session
```python
# 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
```python
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
```python
# 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
```python
# 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
```python
# Get last donations with optional parameters
last_donations = diaka.get_last_donations(limit=10, test=2)
```
### Get Largest Donations
```python
# Get largest donations with optional parameters
largest_donations = diaka.get_largest_donations(offset=86400, limit=10, test=2)
```
### Get Amount of Donations
```python
# Get amount of donations with optional parameters
amount_of_donations = diaka.get_amount_of_donations(offset=86400, test=2)
```
### Establishing a Session
```python
# 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](https://github.com/d3kxrma/diakaplug/blob/main/LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/d3kxrma/diakaplug",
"name": "diakaplug",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,diaka,diaka api,diakapy",
"author": "dekxrma",
"author_email": "qqdjnuxez@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/97/df/b629863ccc5d903bec836c7be4d6630abc87107a5ba1eb377ff610c18c89/diakaplug-0.0.3.tar.gz",
"platform": null,
"description": "# DiakaPlug Library\r\n\r\nThe 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.\r\n\r\nTranslation of [README.md into Ukrainian](https://github.com/d3kxrma/diakaplug/blob/main/README_UK.md).\r\n\r\n## Table of Contents\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n - [Synchronous Diaka Class](#synchronous-diaka-class)\r\n - [Asynchronous AsyncDiaka Class](#asynchronous-asyncdiaka-class)\r\n- [License](#license)\r\n\r\n## Installation\r\n\r\nTo use the Diakaplug library, you'll need to install it via pip:\r\n\r\n```bash\r\npip install diakaplug\r\n```\r\n## Usage\r\n\r\n### Synchronous Diaka Class\r\n\r\nThe `Diaka` class provides synchronous methods for interacting with the Diaka service.\r\n\r\n#### Initialization\r\n\r\n```python\r\nfrom diakaplug import Diaka\r\n\r\n# Initialize the Diaka class with a Diaka notification URL\r\ndiaka = Diaka(\"https://c.diaka.ua/notification_url\")\r\n```\r\n### Sending a Test Notification\r\n```python\r\n# Send a test notification with optional parameters\r\nstatus_code = diaka.send_test_notification(\r\n target=\"TargetName\",\r\n amount=54,\r\n name=\"DiakaPlug\",\r\n message=\"Hi from Python\",\r\n source=\"SourceName\",\r\n show=\"Show\",\r\n additional=\"AdditionalInfo\"\r\n)\r\n```\r\n### Parsing a Notification\r\n```python\r\n# Parse a notification using a transaction ID and hash\r\nnotification_data = diaka.parse_notification(transaction_id=123, hash=\"notification_hash\")\r\n```\r\n### Get Last Donations\r\n```python\r\n# Get last donations with optional parameters\r\nlast_donations = diaka.get_last_donations(limit=10, test=2)\r\n```\r\n### Get Largest Donations\r\n```python\r\n# Get largest donations with optional parameters\r\nlargest_donations = diaka.get_largest_donations(offset=86400, limit=10, test=2)\r\n```\r\n### Get Amount of Donations\r\n```python\r\n# Get amount of donations with optional parameters\r\namount_of_donations = diaka.get_amount_of_donations(offset=86400, test=2)\r\n```\r\n### Establishing a Session\r\n```python\r\n# Establish a session with the SSE server and yield parsed notifications\r\nfor notification in diaka.session():\r\n print(notification)\r\n```\r\n\r\n### Asynchronous AsyncDiaka Class\r\n\r\nThe `AsyncDiaka` class provides asynchronous methods for interacting with the Diaka service.\r\n\r\n#### Initialization\r\n\r\n```python\r\nfrom diakaplug import AsyncDiaka\r\n\r\n# Initialize the AsyncDiaka class with a Diaka notification URL\r\nasync_diaka = AsyncDiaka(\"https://c.diaka.ua/notification_url\")\r\n```\r\n### Sending a Test Notification\r\n```python\r\n# Send a test notification with optional parameters\r\nstatus_code = await async_diaka.send_test_notification(\r\n target=\"TargetName\",\r\n amount=54,\r\n name=\"DiakaPlug\",\r\n message=\"Hi from Python\",\r\n source=\"SourceName\",\r\n show=\"ShowName\",\r\n additional=\"AdditionalInfo\"\r\n)\r\n```\r\n### Parsing a Notification\r\n```python\r\n# Parse a notification using a transaction ID and hash\r\nnotification_data = await async_diaka.parse_notification(transaction_id=123, hash=\"notification_hash\")\r\n```\r\n### Get Last Donations\r\n```python\r\n# Get last donations with optional parameters\r\nlast_donations = diaka.get_last_donations(limit=10, test=2)\r\n```\r\n### Get Largest Donations\r\n```python\r\n# Get largest donations with optional parameters\r\nlargest_donations = diaka.get_largest_donations(offset=86400, limit=10, test=2)\r\n```\r\n### Get Amount of Donations\r\n```python\r\n# Get amount of donations with optional parameters\r\namount_of_donations = diaka.get_amount_of_donations(offset=86400, test=2)\r\n```\r\n### Establishing a Session\r\n```python\r\n# Establish a session with the SSE server and yield parsed notifications\r\nasync for notification in async_diaka.session():\r\n print(notification)\r\n```\r\n\r\n# License\r\nThis project is licensed under the [MIT License](https://github.com/d3kxrma/diakaplug/blob/main/LICENSE).\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "a simple python library to receive notifications from diaka.ua",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/d3kxrma/diakaplug"
},
"split_keywords": [
"python",
"diaka",
"diaka api",
"diakapy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "97dfb629863ccc5d903bec836c7be4d6630abc87107a5ba1eb377ff610c18c89",
"md5": "27a5d173cfcbe23b73ad01aefce617a4",
"sha256": "cde99d14ccbd09de61f1513dc5b9507b1b243c185f8564d1f51f47ab00d0ffb0"
},
"downloads": -1,
"filename": "diakaplug-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "27a5d173cfcbe23b73ad01aefce617a4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5108,
"upload_time": "2023-10-18T11:27:07",
"upload_time_iso_8601": "2023-10-18T11:27:07.211464Z",
"url": "https://files.pythonhosted.org/packages/97/df/b629863ccc5d903bec836c7be4d6630abc87107a5ba1eb377ff610c18c89/diakaplug-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-18 11:27:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "d3kxrma",
"github_project": "diakaplug",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "diakaplug"
}