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.24.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9200c2c0f4007956f389bf527e6e020cc72688ca6c9db00b45c160878f9be19 |
|
MD5 | e5925ffc44acdcdb828303a5ca4faab9 |
|
BLAKE2b-256 | 2fb1a0e26c24fb3e9d6f3de07fc64e39edbff289dbcdd03b5b9f9a1742302758 |
Close
Hashes for http_request_response-0.0.24-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87606c8291f8220b41f9176416777cdb1153c08d9a3c4f9bec2371a3139a30db |
|
MD5 | dc123b3aae84a89738b36e5ffc69b9d1 |
|
BLAKE2b-256 | 7c90b0c24c82c4ce921a554567aa5bfed706ebf4ba38e89af274c337026ed9d2 |