PerformanceWatch is a monitoring tool that continuously checks performance pages for free seats and sends notifications (via Telegram) when new free seats become available. The project leverages asynchronous browser automation using Playwright and follows a modular design based on SOLID principles.
- Real-Time Monitoring: Continuously monitors performance pages.
- Notification System: Sends alerts via Telegram when new free seats are detected.
- Asynchronous Processing: Uses asynchronous routines for efficient concurrent operations.
- Modular Architecture: Clean separation of configuration, logging, scraping, and monitoring logic.
-
Clone the Repository:
git clone https://github.com/ihor-haivan/performance_watch.git cd performance_watch -
Create a Virtual Environment and Install Dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Install Playwright Browsers (if not already installed):
playwright install
-
Environment Variables:
Create a.envfile in the root directory. Please run:cp .env.example .env
Then edit the
.envfile with your own values:BOT_TOKEN=your_telegram_bot_token CHAT_IDS=chat_id1,chat_id2,chat_id3BOT_TOKEN: Your Telegram bot token obtained from BotFatherCHAT_IDS: Comma-separated list of Telegram chat IDs to receive notifications
-
Performance URLs:
Specify the URLs for the performance pages you want to monitor directly inmain.py. This allows flexibility to update or add monitored pages without altering core configuration. -
Logging:
Logging settings are managed vialogger_manager.py. You can adjust the log level, file, rotation parameters, and logger name there.
Start the application using the main entry point:
python main.pyThe monitoring tool will start, and you should see log messages on the console (and in the log file). When new free seats are detected, a Telegram message will be sent based on your configuration.
performance_watch/
├── config.py # Application configuration (except logging and performance URLs)
├── logger_manager.py # Logging configuration and LoggerManager class
├── notifier.py # Notifier interface and TelegramNotifier implementation
├── scraper.py # PerformanceScraper for web data extraction
├── monitor.py # PerformanceMonitor for orchestrating monitoring logic
├── main.py # Main entry point of the application
├── setup.py # Package setup script
├── README.md # Project overview and instructions
└── tests/ # Test suite for the project
└── __init__.py # Makes the tests directory a package
└── test_monitor.py # Contains tests for the monitoring functionality
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
- Commit and push your changes.
- Open a Pull Request describing your improvements.
This project is licensed under the MIT License. See the LICENSE file for details.