Metadata-Version: 2.1
Name: webnotifier
Version: 0.1.1
Summary: A package for notifying any webpage change
Home-page: https://github.com/polmp/webnotifier
Author: Pol MP
Author-email: pol.moreno30@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: requests (>=2.21.0)
Requires-Dist: lxml (>=4.3.3)

# WebNotifier

![PyPI](https://img.shields.io/pypi/v/webnotifier.svg)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/webnotifier.svg)
![PyPI - Status](https://img.shields.io/pypi/status/webnotifier.svg)
![PyPI - License](https://img.shields.io/pypi/l/webnotifier.svg)

Webnotifier is a simple package for notifying any webpage change.

## Requirements

This package needs:

- Requests >= 2.21.0
- lxml >= 4.3.3

## Installation

To install Webnotifier, use pip

```bash
$ pip install webnotifier
```

## Usage

Instanciate the WebNotifier class and pass an url array and two callbacks. Also, you can pass the interval time (in seconds).

```python
from webnotifier import WebNotifier

my_urls = [{'name':'Google','href':'https://www.google.com'}, {'name':'Medium','href':'https://medium.com'},{'name':'Localhost','href':'http://127.0.0.1:3000'}]

def onError(err):
    """
    URL and Name params can be accessed within err.name && err.url
    """
    print("There was an error with {} on {}".format(err.name, err.url))

def onNewChange(url,name):
    print("Webpage {} on {} changed!".format(name,url))

interval = 60 #Check if webpage changes every 60 seconds

custom_webnotifier = WebNotifier(my_urls,onNewChange,onError,interval)
custom_webnotifier.start()
```

When a webpage changes, the onNewChange callback will be triggered. Otherwise, if there's any error in getting the URL, onError callback will be executed.

