Skip to content

ihor-haivan/performance_watch

Repository files navigation

PerformanceWatch

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.

Features

  • 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.

Installation

  1. Clone the Repository:

    git clone https://github.com/ihor-haivan/performance_watch.git
    cd performance_watch
  2. 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
  3. Install Playwright Browsers (if not already installed):

    playwright install

Configuration

  • Environment Variables:
    Create a .env file in the root directory. Please run:

    cp .env.example .env

    Then edit the .env file with your own values:

    BOT_TOKEN=your_telegram_bot_token
    CHAT_IDS=chat_id1,chat_id2,chat_id3
    
    • BOT_TOKEN: Your Telegram bot token obtained from BotFather
    • CHAT_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 in main.py. This allows flexibility to update or add monitored pages without altering core configuration.

  • Logging:
    Logging settings are managed via logger_manager.py. You can adjust the log level, file, rotation parameters, and logger name there.

Usage

Start the application using the main entry point:

python main.py

The 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.

Folder Structure

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    

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch:
    git checkout -b feature/your-feature-name
  3. Commit and push your changes.
  4. Open a Pull Request describing your improvements.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages