HumanTech - Telegram Notification - Python Client
How to install
$ pip install telenotipy
How to use
- Create a new TelegramNotificationClient with your API token
from telenotipy import TelegramNotificationClient
client = TelegramNotificationClient('API TOKEN')
The token must be retrieved from the TeleNotiPy server instance.
- Send notifications to your users!
client.send_notification(
to=['UserID1', 'UserID2']
message="Hi from My Application"
)
Simple flow
- First you want to send a subscription to a Telegram User
from telenotipy import TelegramNotificationClient
client = TelegramNotificationClient('MY API TOKEN')
subscription = client.create_subscription()
# Send subscription.id to a Telegram user
# The user must send the command /start followed by this token to the bot
# This can be simplified by giving the user a Start link:
# - https://telegram.me/MyTeleNotiPyBot?start=TheSubscriptionID
- Then you might want to check if the user has accepted the subscription
from telenotipy import TelegramNotificationClient
client = TelegramNotificationClient('MY API TOKEN')
subscription = client.get_subscription(the_subscription_id)
print(subscription.is_bound)
# If the subscription is bound, it means that the user has accepted
- You want to send notifications to one or more Telegram Users
from telenotipy import TelegramNotificationClient
client = TelegramNotificationClient('MY API TOKEN')
client.send_notification(
to=[the_subscription_id_1, the_subscription_id_2, ...]
message="Hi, here is my message!"
)
Advanced usage
Use a different server
client = TelegramNotificationClient('API TOKEN', 'The telenotipy server address')
Create a new subscription
subscription = client.create_subscription()
subscription.id # The User Token
subscription.is_bound # Whether the subscription is bound to a Telegram User, is False when creating
List your existing subscriptions
subscriptions = client.list_subscriptions(page=1)
subscriptions.previous_page # The Previous page number
subscriptions.next_page # The Next page number
subscriptions.count # The total count of subscriptions (all pages)
subscriptions.results # The list of subscriptions
Get the info about an existing subscription
subscription_id = 'The Subscription ID'
subscription = client.get_subscription(subscription_id):
subscription.id # The User Token
subscription.is_bound # Whether the subscription is bound to a Telegram User
Delete an existing subscription
subscription_id = 'The Subscription ID'
client.delete_subscription(subscription_id):
Metadata
Release files for telenotipy 0.0.2
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 | |
|---|---|---|---|---|
| telenotipy-0.0.2.tar.gz | 3.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| telenotipy-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / telenotipy-0.0.2.tar.gz
| Download URL | telenotipy-0.0.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
510a93ebf8a5911f23f9405170e360e3d995d068482df762ce9e75760dd72a57
|
|
BLAKE2b-256 checksum How to use checksums |
7566486045f2cd45479712845df1831e0cefb000461dbf3994c0e47589a9e0ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7
|
Release files / telenotipy-0.0.2-py3-none-any.whl
| Download URL | telenotipy-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2711cad5a6619b0c4d45a274d96a0b048cb8012ea929fa9464df355401f40f3a
|
|
BLAKE2b-256 checksum How to use checksums |
6a7ff3541d61f802c5d7f0c472183413f76ad2495471bba4b91a06b489fbf7ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7
|
Security for telenotipy 0.0.2
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.