telegram-python 0.3.0__py3-none-any.whl → 0.3.2__py3-none-any.whl
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_send → telegram_python}/telegram_send.py +4 -3
- telegram_python-0.3.2.dist-info/METADATA +20 -0
- telegram_python-0.3.2.dist-info/RECORD +5 -0
- {telegram_python-0.3.0.dist-info → telegram_python-0.3.2.dist-info}/WHEEL +1 -2
- telegram_python-0.3.0.dist-info/METADATA +0 -11
- telegram_python-0.3.0.dist-info/RECORD +0 -6
- telegram_python-0.3.0.dist-info/top_level.txt +0 -1
- {telegram_send → telegram_python}/__init__.py +0 -0
|
@@ -2,7 +2,10 @@ import requests
|
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
import os
|
|
4
4
|
import logging
|
|
5
|
+
from dotenv import load_dotenv
|
|
5
6
|
|
|
7
|
+
# Завантаження змінних середовища з .env файлу
|
|
8
|
+
load_dotenv()
|
|
6
9
|
start_hour = int(os.getenv("TELEGRAM_START_HOUR", 0))
|
|
7
10
|
end_hour = int(os.getenv("TELEGRAM_END_HOUR", 24))
|
|
8
11
|
bot_token = os.getenv("TELEGRAM_BOT_TOKEN")
|
|
@@ -22,15 +25,13 @@ def send(message: str) -> None:
|
|
|
22
25
|
try:
|
|
23
26
|
if len(message) > telegram_max_symbol:
|
|
24
27
|
message = message[:telegram_max_symbol]
|
|
25
|
-
|
|
26
28
|
url = f"https://api.telegram.org/bot{bot_token}/sendMessage"
|
|
27
29
|
payload = {
|
|
28
30
|
"chat_id": chat_id,
|
|
29
31
|
"text": message
|
|
30
32
|
}
|
|
31
33
|
my_rez=requests.post(url, json=payload, timeout=10)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
|
|
34
35
|
if my_rez.status_code == 200:
|
|
35
36
|
logging.info(f"Message sent successfully to chat_id={chat_id}")
|
|
36
37
|
else:
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: telegram-python
|
|
3
|
+
Version: 0.3.2
|
|
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_python
|
|
17
|
+
|
|
18
|
+
cd demo
|
|
19
|
+
poe demo
|
|
20
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
telegram_python/__init__.py,sha256=imyb6s9X7XSCuwhyYSTAwWUctgtdiO3GzWBzNKacJDI,158
|
|
2
|
+
telegram_python/telegram_send.py,sha256=VMzD7pEVQSoYrsDgYHcMCtwFB2jtloZhxvox3IYsk9I,1868
|
|
3
|
+
telegram_python-0.3.2.dist-info/METADATA,sha256=r8aiuB5lfvL7iTnWdowK9GzUi1iSB7b9fYGvDRffakw,575
|
|
4
|
+
telegram_python-0.3.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
5
|
+
telegram_python-0.3.2.dist-info/RECORD,,
|
|
@@ -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,6 +0,0 @@
|
|
|
1
|
-
telegram_send/__init__.py,sha256=imyb6s9X7XSCuwhyYSTAwWUctgtdiO3GzWBzNKacJDI,158
|
|
2
|
-
telegram_send/telegram_send.py,sha256=a33Jf5aROlZXZzkiDhn2MlAJtRkReLbCQFRePs1RXCI,1755
|
|
3
|
-
telegram_python-0.3.0.dist-info/METADATA,sha256=OAT82CxyuXVWLO7NDDjR9yWquwB-5pCZcrmiRt8GL-E,284
|
|
4
|
-
telegram_python-0.3.0.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
5
|
-
telegram_python-0.3.0.dist-info/top_level.txt,sha256=p1caPsfF4vqshvK4zD3ZoFUjy9TbzrLwuIUFSMgnEGs,14
|
|
6
|
-
telegram_python-0.3.0.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
telegram_send
|
|
File without changes
|