Metadata-Version: 2.1
Name: website-checker
Version: 0.3.2
Summary: A simple python application for running checks against websites.
Home-page: https://github.com/aidanmelen/website-checker
License: MIT
Keywords: website,checker
Author: Aidan Melen
Author-email: aidanmelen@protonmail.com
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: click (>=7.1.2,<8.0.0)
Requires-Dist: requests (>=2.25.0,<3.0.0)
Requires-Dist: structlog (>=20.1.0,<21.0.0)
Project-URL: Repository, https://github.com/aidanmelen/website-checker
Description-Content-Type: text/markdown

[![Tests](https://github.com/aidanmelen/website-checker/workflows/Tests/badge.svg)](https://github.com/aidanmelen/website-checker/actions?workflow=Tests)
[![PyPI](https://img.shields.io/pypi/v/website_checker.svg)](https://pypi.org/project/website-checker/)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)

# website_checker

A simple python application for running checks against websites.

## Usage

### Install

```bash
$ pipx install website-checker
  installed package site-check 0.1.0, Python 3.9.0
  These apps are now globally available
    - check
done! ✨ 🌟 ✨

# or install into system python with pip
# pip install website-checker
```

### Example

Display help message

```bash
$ check --help
Usage: check [OPTIONS] COMMAND [ARGS]...

  A simple python application for running checks against websites.

Options:
  --debug / --no-debug  Toggle debug mode.
  --version             Show the version and exit.
  --help                Show this message and exit.

Commands:
  health   Check website health.
  latency  Check website latency.
  network  Check website network connectivity.
```

Some examples

```bash
$ check network -u https://google.com -u https://blarg.com
{"event": {"check": "network", "input": {"timeout": 5, "url": "https://google.com"}, "output": "pass"}, "logger": "website-checker", "timestamp": "2020-11-30T05:27:23.413281"}
{"event": {"check": "network", "input": {"timeout": 5, "url": "https://blarg.com"}, "output": "fail"}, "logger": "website-checker", "timestamp": "2020-11-30T05:27:23.443994"}

$ check health -u https://google.com
{"event": {"check": "health", "input": {"timeout": 5, "url": "https://google.com"}, "output": "pass"}, "logger": "website-checker", "timestamp": "2020-11-30T05:27:49.413241"}

$ check latency -u https://google.com
{"event": {"check": "latency", "input": {"threshold": 500, "timeout": 5, "url": "https://google.com"}, "output": "pass"}, "logger": "website-checker", "timestamp": "2020-11-30T05:28:14.460530"}

# force a check failure with a latency threshold of 1ms
$ check latency --url https://google.com --threshold 1
{"event": {"check": "latency", "input": {"threshold": 1, "timeout": 5, "url": "https://google.com"}, "output": "fail"}, "logger": "website-checker", "timestamp": "2020-11-30T15:17:30.897261"}
```

### Docker

The default Makefile target will run **all** stages in the Dockerfile.

```bash
$ make
# build all stages: base, workspace, build, release
docker build . -t website-checker
[+] Building 0.9s (22/22) FINISHED
...

# verify image and look at the size!
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
website-checker     latest              4ea3d7e18eec        18 seconds ago      55.6MB

# run website check with container
$ docker run --rm -it website-checker \
health --url https://google.com
{"event": {"check": "health", "input": {"timeout": 5, "url": "https://google.com"}, "output": "pass"}, "logger": "website-checker", "timestamp": "2020-11-30T05:00:23.444290"}
```

# License

Check out the [LICENSE](./LICENSE) for more information.

# Credits

Check out the [CREDITS](./docs/CREDITS.md) for more information.

