Metadata-Version: 2.1
Name: pypoller
Version: 0.1.0
Summary: Lightweight polling and notification framework
Author-email: Mohit Chauhan <mhchauhan3@gmail.com>
License: MIT License
        
        Copyright (c) [2024] [Mohit Chauhan]
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp==3.9.3
Requires-Dist: aiohttp-retry==2.8.3
Requires-Dist: aiosignal==1.3.1
Requires-Dist: attrs==23.2.0
Requires-Dist: certifi==2024.2.2
Requires-Dist: charset-normalizer==3.3.2
Requires-Dist: frozenlist==1.4.1
Requires-Dist: greenlet==3.0.3
Requires-Dist: idna==3.6
Requires-Dist: Jinja2==3.1.3
Requires-Dist: MarkupSafe==2.1.5
Requires-Dist: multidict==6.0.5
Requires-Dist: pdoc==14.4.0
Requires-Dist: playwright==1.42.0
Requires-Dist: pyee==11.0.1
Requires-Dist: Pygments==2.17.2
Requires-Dist: PyJWT==2.8.0
Requires-Dist: python-dotenv==1.0.1
Requires-Dist: requests==2.28.2
Requires-Dist: ruff==0.3.3
Requires-Dist: twilio==8.11.1
Requires-Dist: typing_extensions==4.10.0
Requires-Dist: urllib3==1.26.18
Requires-Dist: yarl==1.9.4

# pypoller

## Overview

pypoller is a lightweight and easy-to-use framework for polling a resource at regular intervals and providing notifications on any updates. It is designed to simplify the process of monitoring a remote service for changes and alerting users or systems when relevant updates occur.

Detailed docs available at https://www.mohitc.com/pypoller/docs/

## Features

- **Polling**: The library allows you to define a polling interval, specifying how frequently the resource should be checked for updates.

- **Notifications**: When a change is detected in the service, the library supports customizable notification mechanisms. Currently messaging via Twilio is implemented.

- **Configurability**: The library is highly configurable and extensible. Adding support for any notification mechanism or resource should be seamless.

All submodules can be used independently as well. For example, to check for availability of US Visa appointments:

```
UGANDA_EMBASSY = "en-ug"
SCHEDULE_ID = "50295138"
FACILITY_ID = "106"
USER_EMAIL = "user_email"
PASSWORD = "password"

# Initialize resource checker for US Visa availability
availability_checker = USVisaResourceChecker(
    UGANDA_EMBASSY, SCHEDULE_ID, FACILITY_ID, USER_EMAIL, PASSWORD
)

date_range_request = DateRangeRequest(
    start_date=dt.datetime(2024, 3, 14),
    end_date=dt.datetime(2025, 7, 1),
)

response = availability_checker.check_resource(date_range_request)
```
## Installation

`pip install .`

For playwrigt (US Visa):

`playwright install`

## Usage
Refer to examples to learn how to use the library.

To provide twilio credentials for twilio, create a `.env` file by copying the `.env.sample` file, and replace the placeholder twilio parameters to enable notifications via SMS.

If twilio credentials are not provided, notifications will be printed to console.
