Skip to main content

easy_async_tg_notify

`easy_async_tg_notify` простая асинхронная библиотека, которая позволит вам без заморочек настроить отправку текстовых,
фото, видео, аудио и прочих уведомлений в телеграмм под свои задачи и проекты. Библиотека работает на чистом API 
телеграмм. Для асинхронности используется httpx.

Особенности

  • Асинхронная работа: Благодаря этому вы сможете легко интегрировать библиотеку в любой свой проект без блокировок.
  • Отправка любых форматов сообщений: Библиотека позволит вам отправить: фото, видео, тексты, геоданные и т.д
  • Стилизация текста: Вы можете отправлять красиво отформатированные сообщения (по умолчанию HTML)
  • Поддержка with: Благодоря этому вы сможете выстраивать серию из отправок сообщений, вплетая своим функции в соединение с API
  • Отправка уведомлений одному или нескольким пользователям: На входе принимается или TelegramID пользователя или список
  • Logging: Настраиваемый логгер, который позволит отследить любые события и ошибки

Установка

Установить библиотеку можно через pip

pip install --upgrade easy_async_tg_notify

Пример использования

import asyncio
import os
from decouple import config
from easy_async_tg_notify import Notifier


token = config('TELEGRAM_BOT_TOKEN')
user_id = int(config('TELEGRAM_CHAT_ID'))
users_ids = [int(user_id) for user_id in config('TELEGRAM_CHAT_IDS').split(',')]

# Получаем абсолютный путь к директории, в которой находится текущий скрипт
script_dir = os.path.dirname(os.path.abspath(__file__))
photo = os.path.join(script_dir, 'telegram-logo-27.png')


async def main():
    async with Notifier(token) as notifier:
        await notifier.send_text("Привет, <b>дружище!</b>!", user_id)
        await notifier.send_photo(photo, users_ids)
        await notifier.send_document(photo, user_id, caption='Подпись к документу')
        await notifier.send_contact('+76398836055', 'Алексей', user_id)


asyncio.run(main())

License

Этот проект лицензируется по лицензии MIT.

Release files for easy-async-tg-notify 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easy-async-tg-notify 0.1
File Size Uploaded
easy_async_tg_notify-0.1.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for easy-async-tg-notify 0.1
File Interpreter ABI Platform
easy_async_tg_notify-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / easy_async_tg_notify-0.1.tar.gz

Download URL easy_async_tg_notify-0.1.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
02a4cca320302195cd8f12254909b924d997e93ca953f0524ef00349eaa350ad
BLAKE2b-256 checksum
How to use checksums
f636b9d1753a23e2178e3c93a2774e95fd0ea637215e2bb337ed8a1723228077
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

Release files / easy_async_tg_notify-0.1-py3-none-any.whl

Download URL easy_async_tg_notify-0.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61f5c86ff979425ea618554e07a77a946353fafaebc16b38467e89839b680276
BLAKE2b-256 checksum
How to use checksums
eee60603637f27fcf06bdf39fa6c95170666d242279a0d64aa2d0e712dabe8f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page