# function_validator
Function Validator library comes with a req_validator decorator that validates the function keyword argument against its datatype, keyword name, required and logs the keyerror that you provide in the error description.
Installation Instruction!
===================
>- Activate your Virtual Environment.
>- pip install function-validator
----------
**function-validator** is library having req_validator decorator that validates the request parameters.
# Usage
1. Import function logger library
- `from function_validator import req_validator`
# Example
```python
from function_validator import req_validator
@req_validator(param_name="age", err_description="int not found", req=True, var_type=int)
@req_validator(param_name="name", err_description="string not found", req=True, var_type=basestring)
@req_validator(param_name="quality", err_description="dict not found", req=True, var_type=dict)
@req_validator(param_name="friend_list", err_description="list not found", req=True, var_type=list)
def test_function(**kwargs):
print kwargs
if __name__ == '__main__':
test_function(age = 23, name = "Anand", quality = {"height": 172}, friend_list = ["anand"])
```
Function Validator library comes with a req_validator decorator that validates the function keyword argument against its datatype, keyword name, required and logs the keyerror that you provide in the error description.
Installation Instruction!
===================
>- Activate your Virtual Environment.
>- pip install function-validator
----------
**function-validator** is library having req_validator decorator that validates the request parameters.
# Usage
1. Import function logger library
- `from function_validator import req_validator`
# Example
```python
from function_validator import req_validator
@req_validator(param_name="age", err_description="int not found", req=True, var_type=int)
@req_validator(param_name="name", err_description="string not found", req=True, var_type=basestring)
@req_validator(param_name="quality", err_description="dict not found", req=True, var_type=dict)
@req_validator(param_name="friend_list", err_description="list not found", req=True, var_type=list)
def test_function(**kwargs):
print kwargs
if __name__ == '__main__':
test_function(age = 23, name = "Anand", quality = {"height": 172}, friend_list = ["anand"])
```
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file function_validator-0.1.tar.gz.
File metadata
- Download URL: function_validator-0.1.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c2bd2a105f15c7d60ab94cf89f831af5c3cbd289fb921dbc2fec9f6dc48987c
|
|
| MD5 |
5b00ef46a1ab15ba3fbe13e45edc3fac
|
|
| BLAKE2b-256 |
e653263da09d33110624e54f5cf84282cbb16aae549c4703bdca08f1bf68960a
|