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.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7156911a107c106021ec94045f01f31cc225e57e5399f5203c5426b1bd4164c2 |
|
MD5 | 531363cef501909a0f15051e058bdb0d |
|
BLAKE2b-256 | e084997f52f7eb54511b87a940eb85e8dd9378853bf193e3ddf6dbff4281282e |
Close
Hashes for http_request_response-0.0.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7828021d1fb267ff655e9ae85002f5c4a854347729f63a9202f8136bbcc86b4e |
|
MD5 | eff62d18f6e77879e1a902d47f5b65d5 |
|
BLAKE2b-256 | 1dde14979916c86b861ee07a29f0cc9a0625919bf1a3ee910f0967a8ca21a70f |