tg_notifier
pip install git+https://imbecility:github_pat_***@github.com/imbecility/tg_notifier
pip install git+https://github.com/imbecility/tg_notifier
uv pip install git+https://github.com/imbecility/tg_notifier
uv add git+https://github.com/imbecility/tg_notifier
from pathlib import Path
from tg_notifier import send_message_to_telegram
bot_token = '7036427666:R38OyUtA1ze20vXu8JcxmD_bfSQiIBhi0R1'
chat_id = '656000000'
msg = 'Господи, Иисусе Христе, Сыне Божий, помилуй мя, грешнаго'
tests = [
(f'> _{msg}_', 'MarkdownV2'),
(f'`{msg}`', 'Markdown'),
(f'<blockquote><i>{msg}</i></blockquote>', 'HTML'),
(msg, None)
]
# отправка только текста
for message, mode in tests:
result = send_message_to_telegram(bot_token, chat_id, message, parse_mode=mode)
# print(result)
print(f"Text ({mode}): {'OK' if result.get('ok') else 'FAIL'}")
# ----------------------------------------------------------------
# отправка с изображением
def whatever_image():
"""
просто выдаст путь до первой попавшейся картинки
чтобы для теста не указывать вручную.
"""
from os import scandir
from collections import deque
queue = deque([Path.home().resolve()])
while queue:
folder = queue.popleft()
try:
with scandir(folder) as entries:
for entry in entries:
if entry.is_file() and entry.name.lower().endswith(('.jpg', '.jpeg', '.png')):
return Path(entry.path)
elif entry.is_dir():
queue.append(Path(entry.path))
except:
pass
return None
image_path = whatever_image()
for message, mode in tests:
result = send_message_to_telegram(bot_token, chat_id, message, parse_mode=mode, photo_path=image_path)
# print(result)
print(f"Image ({mode}): {'OK' if result.get('ok') else 'FAIL'}")
Metadata
Release files for tg_notifier 0.1.0
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 | Actions |
|---|---|---|---|---|
| tg_notifier-0.1.0.tar.gz | 3.5 kB | Without provenance | Details for tg_notifier-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tg_notifier-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for tg_notifier-0.1.0-py3-none-any.whl |
Total release size: 7.0 kB
Release files / tg_notifier-0.1.0.tar.gz
| Download URL | tg_notifier-0.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de6af953a7de905d17cbde0f3f8b17197cbf92e59bb7414c48900105e7d9fd3c
|
|
BLAKE2b-256 checksum How to use checksums |
8733b24bccd35490d99f4963084acdf88b2640afb7f6359a865b2a4c77b7cb5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.12
|
Release files / tg_notifier-0.1.0-py3-none-any.whl
| Download URL | tg_notifier-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c228a73fd9038c925ef5e833743786488df92edc37337c28c47dfe92ff8578e
|
|
BLAKE2b-256 checksum How to use checksums |
e2479255d253d7ed7077bee89af963a1ca90bfd127f3972e36d35835efa21903
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.12
|
Security for tg_notifier 0.1.0
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.