ReQBodyMan to easily manage body data received with Request
Project description
Project Description
ReQBodyMan is a package that you can use to manage the validations of body data coming with Request more effectively.
Installation
1 Install to Package
For Windows
pip install ReQBodyMan
For Linux/MacOs
pip3 install ReQBodyMan
2 Dependencies Package
flask
Usage
1 Import The Package
from ReQBodyMan.ReQBodyMan import ReQBodyMan
2 ReQBodyMan Create Object
ReQBodyMans = ReQBodyMan()
2 Get Form Data
If the data comes from the request with a form, you can get the data as follows.
Data : string, int, float, boolean, list, dict,
Parameters : variableName, variableType, booleanType=NoneRequired
booleanType default = "int"
Return: data
data = ReQBodyMans.params(variableName, variableType, booleanType="int")
data = ReQBodyMans.form("variableName", "str")
data = ReQBodyMans.form("variableName", "int")
data = ReQBodyMans.form("variableName", "float")
data = ReQBodyMans.form("variableName", "bool", booleanType="bool")
data = ReQBodyMans.form("variableName", "bool", booleanType="int" )
data = ReQBodyMans.form("variableName", "list")
data = ReQBodyMans.form("variableName", "dict")
If Variable Type is sent outside the specified format, return None.
3 Get Json Data
Data : string, int, float, boolean, list, dict,
Parameters : variableName, variableType, booleanType=NoneRequired
booleanType default = "int"
Return : Data
data = ReQBodyMans.params(variableName, variableType, booleanType="int")
data = ReQBodyMans.json("variableName", "str")
data = ReQBodyMans.json("variableName", "int")
data = ReQBodyMans.json("variableName", "float")
data = ReQBodyMans.json("variableName", "bool", booleanType="bool")
data = ReQBodyMans.json("variableName", "bool", booleanType="int")
data = ReQBodyMans.json("variableName", "list")
data = ReQBodyMans.json("variableName", "dict")
If Variable Type is sent outside the specified format, return None.
4 Get File
Data : file
Parameters : fileName
Return: file
file = ReQBodyMans.file("fileName")
If FileName is not in request.file, the value "The {fileName} is not in request.files" is returned.
5 Get Params
Data : string, int, float, boolean, list,
Parameters : variableName, variableType, booleanType=NoneRequired
booleanType default = "int"
Return : data
data = ReQBodyMans.params(variableName, variableType, booleanType="int")
data = ReQBodyMans.params("variableName", "str")
data = ReQBodyMans.params("variableName", "int")
data = ReQBodyMans.params("variableName", "float")
data = ReQBodyMans.params("variableName", "bool", booleanType="bool")
data = ReQBodyMans.params("variableName", "bool", booleanType="int")
data = ReQBodyMans.params("variableName", "list")
6 GetAllData Function
Data : string, int, float, boolean, list, file,
Parameters : bodyJson
variableName : Variable name in body data
bodyType : form, json, params, file
booleanType: int, bool
Return : allVariablesJson
data = ReQBodyMans.getAllData(bodyJson)
bodyJson = {
"variableName" : ["bodyType", "variableType", "booleanType"]
}
# BodyType Json
bodyJson = {
"password" : ["json", "str"],
"email" : ["json", "str"]
}
# Boolean Type Usage
bodyJson = {
"password" : ["json", "str"],
"email" : ["json", "str"],
"status" : ["json", "str", "int"]
"status2" : ["json", "str", "bool"]
}
# BodyType Form
bodyJson = {
"password" : ["form", "str"],
"email" : ["form", "str"],
"status" : ["form", "str", "int"]
"status2" : ["form", "str", "bool"]
"fileName" : ["file"]
}
# BodyForm Params
bodyJson = {
"password" : ["params", "str"],
"email" : ["params", "str"],
"status" : ["params", "str", "int"]
"status2" : ["params", "str", "bool"]
}
data = ReQBodyMans.getAllData(bodyJson)
Return data content
{
"email" : "test@test.com",
"password":"test2",
"status" : "1" or "0",
"status2" : True or False,
"fileName" : file
}
If Variable Type is sent outside the specified format, return None.
Release Note
v.1.2.1
- ReadMe file updated
v1.2.0
- getAllData Function Added
- Allows you to send all the data at once and receive the data as a dictionary
v.1.1.0
- Added dict property to Params.
- Added dict property to Json
- The return value for bool type has been added to return int or bool type according to the value to be given with booleanType.
- Code refactor.
v.1.0.1
- ReadMe file updated
v.1.0.0
- Project published.
ReQBodyMan is a BrainyTech Product.
Developer : Murat Bilginer
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ReQBodyMan-1.2.1.tar.gz.
File metadata
- Download URL: ReQBodyMan-1.2.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19fcbc435336f1f0c1391e9a83f4c1a16fd17efc6331b588e14ab6165afb83c1
|
|
| MD5 |
cf71485b5f51c8e8e1131e4510fb7a85
|
|
| BLAKE2b-256 |
e9997c515084fe08764c0f712554a8a06efdb40ef89ec78b213a54fd583f126c
|
File details
Details for the file ReQBodyMan-1.2.1-py3-none-any.whl.
File metadata
- Download URL: ReQBodyMan-1.2.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8615e6575022af975c060baf9f4514abf515a5432c5841fc1e44c974ec4ed8f4
|
|
| MD5 |
c233d3058e810e3ed58e87660a579cdc
|
|
| BLAKE2b-256 |
38b641bb19cb0be793caf90363da50c03747c6546862731783b8dbe3cb8aa596
|