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
Raw data
{
"_id": null,
"home_page": "https://github.com/mojtabapaso/fastexception",
"name": "fastexception",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "FastAPI Tools Fast Exception",
"author": "Mojtaba",
"author_email": "mojtabapaso@gamil.com",
"download_url": "https://files.pythonhosted.org/packages/d5/c0/ed9e89dd05ad58911c70e89f7cd0b6287bcf608bed6fd86bb85d003eaa13/fastexception-0.1.5.1.tar.gz",
"platform": null,
"description": "fast exception\n===================\nThis package is a plugin for easier handling of Exception and sending HTTP status code.\n\nInstalling\n============\n\n pip install fastexception\n\nUsage\n=======\nYou can use FastAPI itself as follows:\n\n @app.get(\"/\")\n def index(password: str):\n if password.validate():\n raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=\"message\")\n\n status code : 400\n message : message\nBut the simpler and more readable way to use fastexception is as follows:\n\n\n @app.get(\"/\")\n def index(password: str):\n if password.validate():\n FastException.HTTP_400_BAD_REQUEST.http(\"message\")\n\n\n status code : 400\n message : message\n\nYou can write your desired message in http, if you don't write it, fastexception will show the appropriate message.\n\n @app.get(\"/\")\n def index(password: str):\n if password.validate():\n FastException.HTTP_400_BAD_REQUEST.http()\n\n\n status code : 400\n message : Bad Request\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "",
"version": "0.1.5.1",
"project_urls": {
"Homepage": "https://github.com/mojtabapaso/fastexception"
},
"split_keywords": [
"fastapi",
"tools",
"fast",
"exception"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d5c0ed9e89dd05ad58911c70e89f7cd0b6287bcf608bed6fd86bb85d003eaa13",
"md5": "73158f325fdc055f149c767612e71c10",
"sha256": "da0fc05ddc3e6f07c7e09e3da9aecd3896165696049b1c36265e4d86ba6994f9"
},
"downloads": -1,
"filename": "fastexception-0.1.5.1.tar.gz",
"has_sig": false,
"md5_digest": "73158f325fdc055f149c767612e71c10",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4096,
"upload_time": "2023-06-28T18:29:37",
"upload_time_iso_8601": "2023-06-28T18:29:37.554182Z",
"url": "https://files.pythonhosted.org/packages/d5/c0/ed9e89dd05ad58911c70e89f7cd0b6287bcf608bed6fd86bb85d003eaa13/fastexception-0.1.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-28 18:29:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mojtabapaso",
"github_project": "fastexception",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "starlette",
"specs": [
[
"==",
"0.28.0"
]
]
}
],
"lcname": "fastexception"
}