Skip to main content

Bottle Errors Rest

bottle_errorsrest plugin for bottle

All errors are now returned bottle json format.

If HTTPError receives a string becomes {‘message’: string}

installation

Via pip: pip install bottle_errorsrest

Or clone: git clone https://github.com/agalera/bottle_errorsrest.git

example server:

from bottle import get, install, run, HTTPError
from bottle_errorsrest import ErrorsRestPlugin


@get("/")
def example():
    # {'message': 'oh no!'}
    raise HTTPError(500, "oh no!")

@get("/2")
def example2():
    # {'other_Example': 'oh no!'}
    raise HTTPError(500, {'other_Example': 'oh no!'})


install(ErrorsRestPlugin())

run(host="0.0.0.0", port="9988")

Test:

curl http://localhost:9988/ --head; curl http://localhost:9988/
HTTP/1.0 500 Internal Server Error
Date: Tue, 27 Sep 2016 11:16:41 GMT
Server: WSGIServer/0.2 CPython/3.4.3
Content-Type: application/json
Content-Length: 20

{"message": "oh no!"}

curl http://localhost:9988/2 --head; curl http://localhost:9988/2
HTTP/1.0 500 Internal Server Error
Date: Tue, 27 Sep 2016 11:16:41 GMT
Server: WSGIServer/0.2 CPython/3.4.3
Content-Type: application/json
Content-Length: 20

{"other_Example": "oh no!"}

curl http://localhost:9988/not_found --head; curl http://localhost:9988/not_found
HTTP/1.0 404 Not Found
Date: Tue, 27 Sep 2016 11:11:39 GMT
Server: WSGIServer/0.2 CPython/3.4.3
Content-Length: 38
Content-Type: application/json

{"message": "Not found: '/not_found'"}

Metadata

Release files for bottle_errorsrest 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bottle_errorsrest 0.0.3
File Size Uploaded Provenance Actions
bottle_errorsrest-0.0.3.tar.gz 2.4 kB Without provenance Details for bottle_errorsrest-0.0.3.tar.gz

Release files / bottle_errorsrest-0.0.3.tar.gz

Download URL bottle_errorsrest-0.0.3.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9e981b8c3190880a060f842ab94e520bb25bda10cc9a3a8b41a6a65294cb3df4
BLAKE2b-256 checksum
How to use checksums
a1e0d267b777195d8c6e5b4b772476fd57cf43af5cc7befd80493b4210eed98e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for bottle_errorsrest 0.0.3

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.

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page