The main target of this library is to standardize the request response in case of using flask-restplus library.
Project description
http_request_response
Introduction
Getting Started
Contributors
License
Introduction
The main target of this library is to standardize the request response in case of using flask-restplus library.Getting Started
In order to install, open the command prompt and type ✌️:pip install http-request-response
In order to import:
from http_request_response import RequestUtilities
Mainly this library has two classes:
- RequestResponse
- RequestUtilities
The response when it is used is like the following:
Response body
{
"status_code": ,
"data": ,
"message": ""
}
In order to use, the endpoint-function should be decorated with try_except decorartors:
@cls.api.route('/')
class ItemPost(Resource):
##### Post
@RequestUtilities.try_except
def post(self):
""" Create a new record """
return business_obj.create(request.body_args)
You have to make sure that the function returns two items:
- The first one is an object of status code (refer to http_status_code library)
- JSON serializable data
Contributors
This project exists thanks to all the people who contribute. [Contribute]. ""
License
This library is licensed under the MIT License - see the LICENSE.md file for details.
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
Built Distribution
Close
Hashes for http_request_response-0.0.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9b1450861512dbb8942ff021cef47b1ad023e3cb11e099bfe0a3bcd0ac07e7b |
|
MD5 | 3e2290ff628f809e53485cf260b3b48f |
|
BLAKE2b-256 | 58eae728ccea0c2dbb8af9a009ed095f342190f3b900de930d28dde080bb1295 |
Close
Hashes for http_request_response-0.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c701de9b8017c51b0cecfea1f138c71047b5cb14ca3a33b243953919d4ada78e |
|
MD5 | 01df6c23775f44c1550c0dec97b531d1 |
|
BLAKE2b-256 | ded5ff4a2d280e0b8ac745cb3f142cc1b4e9deb51b36c0aad4fdbb24af60f54d |