telegram-pm 0.1.1__tar.gz → 0.1.2__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.
Files changed (21) hide show
  1. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/PKG-INFO +26 -3
  2. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/README.md +25 -2
  3. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/pyproject.toml +1 -1
  4. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/LICENSE +0 -0
  5. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/__init__.py +0 -0
  6. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/config.py +0 -0
  7. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/database/__init__.py +0 -0
  8. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/database/db.py +0 -0
  9. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/entities.py +0 -0
  10. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/http_client/__init__.py +0 -0
  11. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/http_client/client.py +0 -0
  12. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/parsers/__init__.py +0 -0
  13. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/parsers/base.py +0 -0
  14. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/parsers/post.py +0 -0
  15. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/parsers/preview.py +0 -0
  16. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/parsers/tag_options.py +0 -0
  17. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/run.py +0 -0
  18. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/utils/__init__.py +0 -0
  19. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/utils/logger.py +0 -0
  20. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/utils/parse.py +0 -0
  21. {telegram_pm-0.1.1 → telegram_pm-0.1.2}/telegram_pm/utils/url.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: telegram-pm
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Telegram preview page parser
5
5
  Author: Your Name
6
6
  Author-email: you@example.com
@@ -85,7 +85,7 @@ poetry install
85
85
  | `--verbose`/`--v` | Verbose mode | ➖ |
86
86
  | `--help`/`--h` | Help information | ➖ |
87
87
 
88
- **Poetry**:
88
+ **Poetry:**
89
89
  ```bash
90
90
  poetry run tpm --ch freegaza --ch BREAKINGNewsTG --db-path .\tg.db --v
91
91
  ```
@@ -93,7 +93,7 @@ or
93
93
  ```bash
94
94
  poetry run tpm --channels-filepath /path/to/monitoring_usernames.txt --db-path .\tg.db
95
95
  ```
96
- **Docker**:
96
+ **Docker:**
97
97
  ```bash
98
98
  docker run -it --rm tpm --ch freegaza --db-path test_tg.db --v
99
99
  ```
@@ -109,6 +109,29 @@ docker run -it --rm \
109
109
  -v ~/tpm_data_dir/usernames.txt:/data/usernames.txt \
110
110
  telegram_pm --db-path /data/telegram_messages.sqlite --chf /data/usernames.txt
111
111
  ```
112
+ **Python:**
113
+ ```python
114
+ from telegram_pm.run import run_tpm
115
+
116
+
117
+ run_tpm(
118
+ db_path="tg.db", # Path to sqlite database
119
+ channels=["channel1", "channel2"], # Channels list
120
+ verbose=True, # Verbose mode
121
+
122
+ # Configuration (optional)
123
+ tg_iteration_in_preview_count=5, # Number of requests (default 5). 20 messages per request. (1 iter - last 20 messages)
124
+ tg_sleep_time_seconds=60, # Number of seconds after which the next process of receiving data from channels will begin (default 60 seconds)
125
+ tg_sleep_after_error_request=30, # Waiting after a failed requests (default 30)
126
+ http_retries=3, # Number of repeated request attempts (default 3)
127
+ http_backoff=3, # Delay between attempts for failed requests (default 3 seconds)
128
+ http_timeout=60, # Waiting for a response (default 30 seconds)
129
+ http_headers={ # HTTP headers
130
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36"
131
+ }
132
+ )
133
+ ```
134
+
112
135
  ## 🗃️ Database Structure
113
136
 
114
137
  The tables will be named as usernames. Each table is a username that was passed in the running parameters.
@@ -65,7 +65,7 @@ poetry install
65
65
  | `--verbose`/`--v` | Verbose mode | ➖ |
66
66
  | `--help`/`--h` | Help information | ➖ |
67
67
 
68
- **Poetry**:
68
+ **Poetry:**
69
69
  ```bash
70
70
  poetry run tpm --ch freegaza --ch BREAKINGNewsTG --db-path .\tg.db --v
71
71
  ```
@@ -73,7 +73,7 @@ or
73
73
  ```bash
74
74
  poetry run tpm --channels-filepath /path/to/monitoring_usernames.txt --db-path .\tg.db
75
75
  ```
76
- **Docker**:
76
+ **Docker:**
77
77
  ```bash
78
78
  docker run -it --rm tpm --ch freegaza --db-path test_tg.db --v
79
79
  ```
@@ -89,6 +89,29 @@ docker run -it --rm \
89
89
  -v ~/tpm_data_dir/usernames.txt:/data/usernames.txt \
90
90
  telegram_pm --db-path /data/telegram_messages.sqlite --chf /data/usernames.txt
91
91
  ```
92
+ **Python:**
93
+ ```python
94
+ from telegram_pm.run import run_tpm
95
+
96
+
97
+ run_tpm(
98
+ db_path="tg.db", # Path to sqlite database
99
+ channels=["channel1", "channel2"], # Channels list
100
+ verbose=True, # Verbose mode
101
+
102
+ # Configuration (optional)
103
+ tg_iteration_in_preview_count=5, # Number of requests (default 5). 20 messages per request. (1 iter - last 20 messages)
104
+ tg_sleep_time_seconds=60, # Number of seconds after which the next process of receiving data from channels will begin (default 60 seconds)
105
+ tg_sleep_after_error_request=30, # Waiting after a failed requests (default 30)
106
+ http_retries=3, # Number of repeated request attempts (default 3)
107
+ http_backoff=3, # Delay between attempts for failed requests (default 3 seconds)
108
+ http_timeout=60, # Waiting for a response (default 30 seconds)
109
+ http_headers={ # HTTP headers
110
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36"
111
+ }
112
+ )
113
+ ```
114
+
92
115
  ## 🗃️ Database Structure
93
116
 
94
117
  The tables will be named as usernames. Each table is a username that was passed in the running parameters.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telegram-pm"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "Telegram preview page parser"
5
5
  authors = [{name = "Your Name",email = "you@example.com"}]
6
6
  readme = "README.md"
File without changes