django-params-validator
django restframe params validator
use for check django rest api params 用于检查django的rest接口的参数 包括参数的类型、范围 如果参数是bool类型,能将 1, 0转化为布尔值
pip install django-params-validator
Example
from django_params_validator import Params
@Params(book_num=int, book_num__gte=100, book_num__lte=200, book__optional=False)
def some_interface(request, *args, **kwargs):
pass
@Params(name=str, name__default='jack',
create_datetime=Params.DATETIME_STR, create_datetime__format='%Y-%m-%d',
colors=('red', 'blue', 'yellow'), colors__many=True)
def other_interface(request, *args, **kwargs):
colors = kwargs.get('colors')
# colors = ['']
pass
Options
TYPE
name=str
指定参数的类型
其中Params.DATETIME_STR是特殊的时间戳字符串格式
gt/lt/gte/lte
制定参数的范围
num__gte=100
optional
是否是可选参数
default
默认值
many
colors__many=True
是否是列表。
Metadata
Release files for django-params-validator 1.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-params-validator-1.1.10.tar.gz | 4.7 kB | Without provenance | Details for django-params-validator-1.1.10.tar.gz |
Release files / django-params-validator-1.1.10.tar.gz
| Download URL | django-params-validator-1.1.10.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45856d4355cb47ea7ad99dd43a4f5a29904e6fecb5a1d89945ccc052319afe88
|
|
BLAKE2b-256 checksum How to use checksums |
48ddaf5bc6c1e7a4e93a664fde54dfb3e2a59768ea9f9a68ea1d5e2e96c60d0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.5
|
Security for django-params-validator 1.1.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.