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.21.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91329506e71b0037a61b003479f013c89e39e85bcddf463ed8b367b1b0757805 |
|
MD5 | ea5635b9200656373c29a0fabea1b69a |
|
BLAKE2b-256 | c23753bead143955255de5320e911ead673f72e7f210aa0d555cac46c0a8e0b0 |
Close
Hashes for http_request_response-0.0.21-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4ad0c1338023228996c7413c90d8e0ff2c772c6454a6c4c11d481ee082cbbf9 |
|
MD5 | c4d0ac22adb853529269ff1e4a98caac |
|
BLAKE2b-256 | 976a918981bdc6ed607768f36adc47d2cccc4b31321ef8098e7896e3d3803805 |