Skip to main content

No project description provided

Project description

fast exception

This package is a plugin for easier handling of Exception and sending HTTP status code.

Installing

pip install fastexception

Usage

You can use FastAPI itself as follows:

@app.get("/")
def index(password: str):
    if password.validate():
       raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="message")

status code : 400
message : message

But the simpler and more readable way to use fastexception is as follows:

@app.get("/")
def index(password: str):
    if password.validate():
        FastException.HTTP_400_BAD_REQUEST.http("message")


status code : 400
message : message

You can write your desired message in http, if you don't write it, fastexception will show the appropriate message.

@app.get("/")
def index(password: str):
    if password.validate():
        FastException.HTTP_400_BAD_REQUEST.http()


status code : 400
message : Bad Request

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

fastexception-0.1.5.1.tar.gz (4.1 kB view details)

Uploaded Source

File details

Details for the file fastexception-0.1.5.1.tar.gz.

File metadata

  • Download URL: fastexception-0.1.5.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for fastexception-0.1.5.1.tar.gz
Algorithm Hash digest
SHA256 da0fc05ddc3e6f07c7e09e3da9aecd3896165696049b1c36265e4d86ba6994f9
MD5 73158f325fdc055f149c767612e71c10
BLAKE2b-256 d5c0ed9e89dd05ad58911c70e89f7cd0b6287bcf608bed6fd86bb85d003eaa13

See more details on using hashes here.

Provenance

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