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.13.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb443bfa96b6ea7db75b07a3560cbe040d7c0a87d549e7bc65dc8608ee6f03cb |
|
MD5 | 3bdb990bc46aa771d0944e6e4d39351c |
|
BLAKE2b-256 | c725534184b5697f3face15383d3fd497e5e1c01bde073379a3cfac2692658f3 |
Close
Hashes for http_request_response-0.0.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 165425c85700045affaf3b66279352796e64d628fdb3491998402d54073c7a71 |
|
MD5 | be92c06b37c1bc0579c5740cf32267c3 |
|
BLAKE2b-256 | af8b30f34921b7044548a2c35d166b63e5ce64807fab0b3529a0dfb61056a7cf |