Skip to main content

Handler mixin for writing JSON errors

Project description

Handler mixin for writing JSON errors

Version Downloads Status Coverage License

Installation

sprockets.mixins.json_error is available on the Python Package Index and can be installed via pip or easy_install:

pip install sprockets.mixins.json_error

Documentation

https://sprocketsmixinsjson_error.readthedocs.org

Requirements

Example

This examples demonstrates how to use sprockets.mixins.json_error to format errors as JSON.

from sprockets import mixins.json_error
from tornado import web

class MyRequestHandler(json_error.JsonErrorMixin,
                       web.RequestHandler):

    def get(self, *args, **kwargs):
        raise web.HTTPError(404, log_message='My reason')

The response from the handler will automatically be formatted as:

{
    "message": "My reason",
    "type": "Not Found"
}

Version History

Available at https://sprocketsmixinsjson_error.readthedocs.org/en/latest/history.html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sprockets.mixins.json_error-1.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

sprockets.mixins.json_error-1.0.0-py2.py3-none-any.whl (7.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sprockets.mixins.json_error-1.0.0.tar.gz.

File metadata

File hashes

Hashes for sprockets.mixins.json_error-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e957906f8671c64ac01b87eb7aba7000542dfd98f6b8bbc13b65699b0075977b
MD5 3855bbce48f432e173adf52d24088873
BLAKE2b-256 2df83b71e9a7763410d9240192ea860ac3ca7fe1b11d06e83a585fd593b5aa90

See more details on using hashes here.

File details

Details for the file sprockets.mixins.json_error-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sprockets.mixins.json_error-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4392b773459466d11ea59b144227b2c2499fb1d26ebc04a0c62998c02ad16b11
MD5 1eb08984aa7d78796f6bb8fc78969d9a
BLAKE2b-256 614b994a3405513066edeea64c8f46973a12c9b96fdf94b21e420b7fc1f4b4ba

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page