telegram-python 0.3.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- telegram_python-0.3.1/PKG-INFO +20 -0
- telegram_python-0.3.1/README.md +4 -0
- {telegram_python-0.3.0 → telegram_python-0.3.1}/pyproject.toml +5 -6
- telegram_python-0.3.1/telegram_python/README.md +0 -0
- telegram_python-0.3.1/telegram_python/pyproject.toml +14 -0
- telegram_python-0.3.1/telegram_python/telegram_python/__init__.py +0 -0
- telegram_python-0.3.1/telegram_python/tests/__init__.py +0 -0
- telegram_python-0.3.0/PKG-INFO +0 -11
- telegram_python-0.3.0/README.md +0 -3
- telegram_python-0.3.0/setup.cfg +0 -4
- telegram_python-0.3.0/setup.py +0 -19
- telegram_python-0.3.0/telegram_python.egg-info/PKG-INFO +0 -11
- telegram_python-0.3.0/telegram_python.egg-info/SOURCES.txt +0 -9
- telegram_python-0.3.0/telegram_python.egg-info/dependency_links.txt +0 -1
- telegram_python-0.3.0/telegram_python.egg-info/top_level.txt +0 -1
- telegram_python-0.3.0/telegram_send/__init__.py +0 -2
- telegram_python-0.3.0/telegram_send/telegram_send.py +0 -44
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: telegram-python
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: A Python package for sending Telegram messages
|
|
5
|
+
Author: Tatiana
|
|
6
|
+
Author-email: durachevska@ukr.net
|
|
7
|
+
Requires-Python: >=3.10,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
|
|
16
|
+
poetry add telegram_send
|
|
17
|
+
|
|
18
|
+
cd demo
|
|
19
|
+
poe demo
|
|
20
|
+
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
[
|
|
1
|
+
[tool.poetry]
|
|
2
2
|
name = "telegram-python"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.1"
|
|
4
4
|
description = "A Python package for sending Telegram messages"
|
|
5
|
-
authors = [
|
|
6
|
-
{name = "Tatiana", email = "durachevska@ukr.net"}
|
|
7
|
-
]
|
|
5
|
+
authors = ["Tatiana <durachevska@ukr.net>"]
|
|
8
6
|
readme = "README.md"
|
|
9
7
|
|
|
10
8
|
[tool.poetry.dependencies]
|
|
@@ -18,4 +16,5 @@ build-backend = "poetry.core.masonry.api"
|
|
|
18
16
|
packages = [{include = "telegram_send"}]
|
|
19
17
|
|
|
20
18
|
[tool.setuptools.packages]
|
|
21
|
-
find = {exclude = ["demo"
|
|
19
|
+
find = {exclude = ["demo"]}
|
|
20
|
+
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "telegram-python"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = ""
|
|
5
|
+
authors = ["Tatiana <durachevska@ukr.net>"]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
|
|
8
|
+
[tool.poetry.dependencies]
|
|
9
|
+
python = "^3.11"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["poetry-core"]
|
|
14
|
+
build-backend = "poetry.core.masonry.api"
|
|
File without changes
|
|
File without changes
|
telegram_python-0.3.0/PKG-INFO
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: telegram-python
|
|
3
|
-
Version: 0.3.0
|
|
4
|
-
Summary: A Python package for sending Telegram messages
|
|
5
|
-
Author: Tetiana
|
|
6
|
-
Author-email: Tatiana <durachevska@ukr.net>
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
|
|
9
|
-
poetry add telegram_send
|
|
10
|
-
|
|
11
|
-
poetry run python demo/demo.py
|
telegram_python-0.3.0/README.md
DELETED
telegram_python-0.3.0/setup.cfg
DELETED
telegram_python-0.3.0/setup.py
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from setuptools import setup, find_packages
|
|
2
|
-
|
|
3
|
-
# Завантаження вмісту README.md
|
|
4
|
-
with open("README.md", "r", encoding="utf-8") as fh:
|
|
5
|
-
long_description = fh.read()
|
|
6
|
-
|
|
7
|
-
setup(
|
|
8
|
-
name="telegram_send",
|
|
9
|
-
version="0.3.0",
|
|
10
|
-
packages=find_packages(),
|
|
11
|
-
description="sending notifications to telegram", # Короткий опис
|
|
12
|
-
install_requires=[
|
|
13
|
-
"requests"
|
|
14
|
-
],
|
|
15
|
-
author="Tetiana",
|
|
16
|
-
author_email="tetyana.d@nitra.dev",
|
|
17
|
-
long_description=long_description, # Детальний опис
|
|
18
|
-
long_description_content_type="text/markdown", # Формат README
|
|
19
|
-
)
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: telegram-python
|
|
3
|
-
Version: 0.3.0
|
|
4
|
-
Summary: A Python package for sending Telegram messages
|
|
5
|
-
Author: Tetiana
|
|
6
|
-
Author-email: Tatiana <durachevska@ukr.net>
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
|
|
9
|
-
poetry add telegram_send
|
|
10
|
-
|
|
11
|
-
poetry run python demo/demo.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
telegram_send
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
import os
|
|
4
|
-
import logging
|
|
5
|
-
|
|
6
|
-
start_hour = int(os.getenv("TELEGRAM_START_HOUR", 0))
|
|
7
|
-
end_hour = int(os.getenv("TELEGRAM_END_HOUR", 24))
|
|
8
|
-
bot_token = os.getenv("TELEGRAM_BOT_TOKEN")
|
|
9
|
-
chat_id = os.getenv("TELEGRAM_CHAT_ID")
|
|
10
|
-
|
|
11
|
-
logging.basicConfig(level=logging.INFO, filename="py_log.log",filemode="w",
|
|
12
|
-
format="%(asctime)s %(levelname)s %(message)s")
|
|
13
|
-
|
|
14
|
-
def send(message: str) -> None:
|
|
15
|
-
"""
|
|
16
|
-
Відправляє повідомлення в Telegram в заданий час (від 0 до 24).
|
|
17
|
-
"""
|
|
18
|
-
now = datetime.now()
|
|
19
|
-
current_hour = now.hour
|
|
20
|
-
telegram_max_symbol = 4096
|
|
21
|
-
if start_hour <= current_hour and current_hour < end_hour:
|
|
22
|
-
try:
|
|
23
|
-
if len(message) > telegram_max_symbol:
|
|
24
|
-
message = message[:telegram_max_symbol]
|
|
25
|
-
|
|
26
|
-
url = f"https://api.telegram.org/bot{bot_token}/sendMessage"
|
|
27
|
-
payload = {
|
|
28
|
-
"chat_id": chat_id,
|
|
29
|
-
"text": message
|
|
30
|
-
}
|
|
31
|
-
my_rez=requests.post(url, json=payload, timeout=10)
|
|
32
|
-
print(my_rez)
|
|
33
|
-
|
|
34
|
-
if my_rez.status_code == 200:
|
|
35
|
-
logging.info(f"Message sent successfully to chat_id={chat_id}")
|
|
36
|
-
else:
|
|
37
|
-
logging.error(f"Message sent with reason: {my_rez.reason}")
|
|
38
|
-
|
|
39
|
-
except requests.exceptions.RequestException as e:
|
|
40
|
-
logging.error(f"Error sending message: {e}") # помилки, пов’язані з HTTP-запитами
|
|
41
|
-
except Exception as e:
|
|
42
|
-
logging.error(f"Unexpected error: {e}")
|
|
43
|
-
else:
|
|
44
|
-
logging.info(f"Current time ({current_hour}) is outside the allowed range ({start_hour}-{end_hour}).")
|