Metadata-Version: 2.1
Name: simplestatusserver
Version: 1.0.0.0
Summary: A single file python module that simplifies creating and running a simple `Flask` server that reports a json formated dict. Intended to be used with simple apps that run in container style environments, allowing for a basic http server to report the status of the app.
Author-email: Markus Hammer <107761433+MarkusHammer@users.noreply.github.com>
Project-URL: Homepage, https://github.com/MarkusHammer/SimpleStatusServer
Project-URL: Github, https://github.com/MarkusHammer/SimpleStatusServer
Project-URL: Issues, https://github.com/MarkusHammer/SimpleStatusServer/issues
Project-URL: Pull Requests, https://github.com/MarkusHammer/SimpleStatusServer/pulls
Project-URL: Git, https://github.com/MarkusHammer/SimpleStatusServer.git
Keywords: http,https,server,simple,status,monitor,monitoring,quick,single file,flask
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Typing :: Typed
Classifier: Natural Language :: English
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: User Interfaces
Classifier: Topic :: System :: Networking :: Monitoring
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: Utilities
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3
Description-Content-Type: text/markdown
License-File: LICENCE
Requires-Dist: flask
Requires-Dist: typing-extensions ; python_version < "3.8"
Provides-Extra: dev
Requires-Dist: setuptools >=64.0.0 ; extra == 'dev'
Requires-Dist: pip-tools ; extra == 'dev'
Requires-Dist: validate-pyproject[all] ; extra == 'dev'
Requires-Dist: build ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Provides-Extra: threading
Requires-Dist: threading ; extra == 'threading'

# Git Auto Backup

This module is intended to be imported into any script requiring a simple HTTP status reporting page.
This optionally supports threading as well, defining the ```run_threaded``` and ```make_thread``` methods.

[![CodeQL](https://github.com/MarkusHammer/SimpleStatusServer/actions/workflows/codeql.yml/badge.svg)](https://github.com/MarkusHammer/SimpleStatusServer/actions/workflows/codeql.yml)

## Setup

This module can be installed using:

``pip install simplestatusserver``

## Module Interface

This module only contains a single (fully documented) class: ```SimpleStatusServer```.
This cass can be instantiated to generate and when desired, run, a simple HTTP server.
This server will report the data contained within that instance's ```status``` attribute as json.
The instance itself may also be used as a dictionary, passing along all the data contained withing its ```status```
If the ```threading``` module is imported (which can be checked using the module's ```STATUS_SERVER_THREADING_POSSIBLE``` constant), threading related running methods are also defined for this class.
Refer to the docstrings for each method for more information.
This module contains type hints.

### Example

```python:
from simplestatusserver import SimpleStatusServer, STATUS_SERVER_THREADING_POSSIBLE as THREADING_POSSIBLE
#Note: this example presumes that the threading module is available!
assert THREADING_POSSIBLE, "The threading module must be available for this example to work!"

#some code here...

server = SimpleStatusServer(init_status = {"hello": "world"})
server["world"] == "hello" #returns True
server["status"] = "starting..."
#now run the http server
server.run_threaded(debug = True)

#perhaps a startup routine here?

server["status"] = "running"
del server["world"] #lets remove this key...

try:
  #the main part of a script here...
  pass
except Exception as e:
  server["error"] = str(e)
  server["error code"] = 1

#finish off things here...

print("all done!")

```

## Licence

This is licensed under the Mozilla Public License 2.0 (MPL 2.0) Licence. See the ``Licence`` file in this repository for more information.

## Credits

This project uses the 'Flask' python module.

While not required, feel free to credit "*Markus Hammer*" (or just "*Markus*") if you find this code or script useful for whatever you may be doing with it.

**Thanks!**

# Security Policy

While the python source code will be actively maintained, any binary files (if at all provided) are in no way supported.
These are provided as a courtesy and are not intended to be the main usage of this software.
Please keep this in mind when choosing how you wish to use this software.

## Supported Versions

| Version     | Supported |
| ----------- | --------- |
| 1.0.0.0 >= | ✅        |
| 1.0.0.0 <  | ❌        |

## Reporting a Vulnerability

Please report any issues to the email 107761433+MarkusHammer(THEN THE @ SYMBOL HERE)users.noreply.github.com
