# validfilter
## 简单描述
一个用来验证数据格式的模块,已经加入了正则表达式的识别,后期会加入具体某个KEY的是否需要验证的标示.
注释: 其实以前是有想法把每个kv的验证加入http api的验证,后来觉得这样会造成过多的耦合,所以放弃了...
[更多validfilter的介绍](http://xiaorui.cc)
## 安装方法
方法1.
```
pip install validfilter
```
方法2
```
git clone git@github.com:rfyiamcool/validfilter.git
cd validfilter
python setup.py install
```
## 使用方法
```
#coding:utf-8
from validfilter import checkdata
template = {
'name': 'xiaorui',
'age': '.*',
'url' : 'http://.*',
'address': '\w*',
'pets': [
{
'name': 'ying',
'kind': '.*'
}
],
'parents': [{'name': '.*'}],
}
kid = {
'name': "fengyun from xiaorui.cc",
'age': 123,
'url' : 'http://xiaorui.cc',
'address': 'beijing',
'pets': [
{
'name': "liliying",
'kind': "nima",
},
],
'parents': [
{'name': "zhangbin"},
{'name': "liudehua"}
]
}
print checkdata(template, kid)
```
#### Run Result
```
python test.py
xiaorui fengyun from xiaorui.cc
http://.* http://xiaorui.cc
.* 123
.* zhangbin
.* liudehua
.* nima
ying liliying
\w* beijing
True
```
感谢使用,validfilter一开始是用来验证rest post api过来的表单,后来在各个分布式RPC系统中使用验证各方的数据准确性。
END... ...
## 简单描述
一个用来验证数据格式的模块,已经加入了正则表达式的识别,后期会加入具体某个KEY的是否需要验证的标示.
注释: 其实以前是有想法把每个kv的验证加入http api的验证,后来觉得这样会造成过多的耦合,所以放弃了...
[更多validfilter的介绍](http://xiaorui.cc)
## 安装方法
方法1.
```
pip install validfilter
```
方法2
```
git clone git@github.com:rfyiamcool/validfilter.git
cd validfilter
python setup.py install
```
## 使用方法
```
#coding:utf-8
from validfilter import checkdata
template = {
'name': 'xiaorui',
'age': '.*',
'url' : 'http://.*',
'address': '\w*',
'pets': [
{
'name': 'ying',
'kind': '.*'
}
],
'parents': [{'name': '.*'}],
}
kid = {
'name': "fengyun from xiaorui.cc",
'age': 123,
'url' : 'http://xiaorui.cc',
'address': 'beijing',
'pets': [
{
'name': "liliying",
'kind': "nima",
},
],
'parents': [
{'name': "zhangbin"},
{'name': "liudehua"}
]
}
print checkdata(template, kid)
```
#### Run Result
```
python test.py
xiaorui fengyun from xiaorui.cc
http://.* http://xiaorui.cc
.* 123
.* zhangbin
.* liudehua
.* nima
ying liliying
\w* beijing
True
```
感谢使用,validfilter一开始是用来验证rest post api过来的表单,后来在各个分布式RPC系统中使用验证各方的数据准确性。
END... ...
Metadata
Release files for validfilter 3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| validfilter-3.1.tar.gz | 3.0 kB | Details |
Release files / validfilter-3.1.tar.gz
| Download URL | validfilter-3.1.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f609802f208a38db01f3f43c6127b5a0c2f01b4f1e3f79334b1ccb61d2ac4c5c
|
|
BLAKE2b-256 checksum How to use checksums |
68107874e9b46dba4bfe6798f15828049b41b252ad05031e0459c64ff7ae0096
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |