Extension to return cats! Works with Flask and Sanic.
Project description
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 test(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 |
simply_html_template |
... |
Simple python format string (html). Should contain {status_cde} (int) and {image} (url) |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Error Cats-0.0.1.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file Error Cats-0.0.1.tar.gz
.
File metadata
- Download URL: Error Cats-0.0.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c28fb153ad6624e52047a7cb0e32df7a3cd419c1b64cc3289cfb9accc5fde36 |
|
MD5 | 451ac4536e4e6b6283c9e21cc8cbef54 |
|
BLAKE2b-256 | cbec364ed8ee387a934e8539d3af64171377c3ef6b83ba87ad4a63ad792c8da8 |
File details
Details for the file Error_Cats-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: Error_Cats-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75558dfac489c157872fde9222c3c28df26feb2aa5e39a569389c89d6fdbe36d |
|
MD5 | 44ec4d99faa03dabf60ff3acb851bf72 |
|
BLAKE2b-256 | 2e712a5be3d0f0ffb8af390e0f7a1f0b6dc36755081a1e1c8b80df8ebd94fe82 |