Metadata-Version: 2.1
Name: mworks
Version: 1.0.2
Summary: A common utility framework for web microservices
Home-page: UNKNOWN
Author: msm
Author-email: msm@cert.pl
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: flask
Requires-Dist: mistune
Requires-Dist: prometheus-flask-exporter

# mworks

The goal of this project is to remove some boilerplate and add few standard
routes to flask applications.

## Usage

Add common routes to the flask application:

```python
from mworks import CommonRoutes
from flask import Flask

app = Flask(__name__)
mworks = CommonRoutes(app)
```

You can optionally add authorisation for sensitive endpoints:

```python
is_admin = lambda: request.remote_addr == '127.0.0.1'
mworks = CommonRoutes(app, auth_checks=[is_admin])
```

## Features

CommonRoutes has the following endpoints implemented:

- `/healthz` - Always returns HTTP 200, useful for healthchecks
- `/varz` - Get variables for service monitoring. Customizable.
- `/docz` - Read README.md from the application and render it.
- `/logz` - Render logs from the application in the browser.


