mirror of
https://github.com/serega404/VodokanalBot.git
synced 2026-05-30 12:10:01 +03:00
Вынес парсер в отдельный файл
This commit is contained in:
@@ -23,6 +23,24 @@ docker run -d --name VodokanalBot \
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
## Интеграции
|
||||
|
||||
Общая логика парсинга, работы с `data/db.json` и поиска новых сообщений вынесена в [`parser.py`](./parser.py).
|
||||
|
||||
Для новой интеграции достаточно создать свой адаптер отправки и передать его в `publish_new_posts`:
|
||||
|
||||
``` Python
|
||||
from parser import create_session, publish_new_posts
|
||||
|
||||
session = create_session()
|
||||
|
||||
publish_new_posts(
|
||||
send_message=lambda message: print(message),
|
||||
session=session,
|
||||
url="http://www.tgnvoda.ru/avarii.php",
|
||||
)
|
||||
```
|
||||
|
||||
## Библиотеки
|
||||
|
||||
* [Requests](https://requests.readthedocs.io/en/latest/)
|
||||
|
||||
Reference in New Issue
Block a user