Flask/Sanic error cats (and dogs)
Extension that allows you to return error cats instead of regular error pages.
Extension uses:
Usage
Flask
from error_cats import FlaskErrorCats
from flask import Flask
app = Flask(__name__)
FlaskErrorCats(app, status_codes=set(range(0, 600)), animal='dog')
@app.route('/<int:status_code>')
def status_code_view(status_code):
return '', status_code
if __name__ == '__main__':
app.run()
Sanic
from error_cats import SanicErrorCats
from sanic import Sanic
from sanic.response import json
app = Sanic()
SanicErrorCats(app, status_codes=set(range(0, 600)))
@app.route('/<status_code:int>')
async def status_code_view(request, status_code):
return json('', status=status_code)
if __name__ == '__main__':
app.run()
Available parameters
| param | default | value |
|---|---|---|
app |
None (can be configured later) |
Web application (Flask or Sanic) |
animal |
cat |
Available values: cat, dog |
status_codes |
400...599 |
Container with status codes that should be translated into cats |
simple_html_template |
... |
Simple python format string (html). Should contain {status_cde} (int) and {image} (url) |
Release files for Error-Cats 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Error Cats-0.1.0.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Error_Cats-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.3 kB
Release files / Error Cats-0.1.0.tar.gz
| Download URL | Error Cats-0.1.0.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
597b5a01892e163d893570d9b9ea5314b820bd3ee262ee226af7b396ec72916c
|
|
BLAKE2b-256 checksum How to use checksums |
347f6a70f94adde42152b31720d49530ea4c6d9a36ea696a5ad34ed7a35de441
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.0
|
Release files / Error_Cats-0.1.0-py3-none-any.whl
| Download URL | Error_Cats-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
696e731b307585ee3309e3de0afdea83f3f2b71f8899f6bf3576d3788d8af559
|
|
BLAKE2b-256 checksum How to use checksums |
caa4112ae41c12910d3ee61c9c10954d0684a4dd97d35a57d6bc8a52a04245e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.0
|