horseman
Horseman is a toolkit to build WSGI applications. It is heavily tested and uses Cython powered libraries.
The philosophy is : “you pay for what you eat”.
The code is very minimal and tries to provide key components to build upon and create a vastly more complex application.
It conforms to the WSGI standards and allows you to use WSGI middlewares.
Example
Below is an example of a barebone API, handling a GET request on ‘/’ and returning a JSON response.
import logging
from bjoern import run
from horseman.meta import SentryNode, Overhead, APIView
from horseman.response import Response
class Request(Overhead):
data = None
def __init__(self, environ):
self.environ = environ
def extract(self):
self.data = 'somedata'
class View(APIView):
def GET(self, overhead):
return Response.to_json(200, {"Result": "OK"})
VIEWS = {
"/": View()
}
class RootNode(SentryNode):
def resolve(self, path_info, environ):
if view := VIEWS.get(path_info):
request = Request(environ)
return view(request)
def handle_exception(self, exc_info, environ):
logging.error(exc_info)
run(
host="0.0.0.0",
port=8080,
reuse_port=True,
wsgi_app=RootNode(),
)
CHANGES
0.6 (2022-08-25)
Major update.
Simplified the parsing Data class by dropping the attempts at mimicking MultiDict. Parsing no longer separate files from form data and values are stored as a list of tuples containing (name, value).
FormData, TypeCastingDict and Query classes were removed.
0.5 (2022-05-31)
Multipart parser no longer adds empty values to the form multidict.
0.4 (2022-04-06)
Fixed FormData.to_dict to handle empty or false values.
0.3 (2022-04-05)
PATH_INFO is no longer expected to be there in the environ. Some WSGI Servers do NOT provide it if empty.
Added path normalization in the Node __call__ to avoid malformed path info.
0.2 (2021-10-08)
First upload on pypi. Stable 0.2.
0.1 (2021-10-08)
Initial release.
Metadata
Release files for horseman 0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| horseman-0.6.tar.gz | 16.7 kB | Without provenance | Details for horseman-0.6.tar.gz |
Release files / horseman-0.6.tar.gz
| Download URL | horseman-0.6.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66883d6f264e8b55cedc92199d92261a3be8580794948c735cc3d82f4afc7dfc
|
|
BLAKE2b-256 checksum How to use checksums |
c7da6b284152278f02a035ef5de68175629274b016de0083f4d86ab6a9da79f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Security for horseman 0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.