Skip to main content

Validator là thư viện validate dữ liệu input

Version

Phiên bản hiện tại 0.1

Cài đặt:

pip3 install m-validator

Sử dụng:

rules = {
    'key1': [Required, InstanceOf(str)],
    'status': [InstanceOf(int), In([1,2,3])],
    'lang': []
}
data1 = {
    'key1': 'abc',
    'status': 1,
    'lang': 'vi'
}
data2 = {
    'status': 1,
    'lang': 'vi'
}
valid = HttpValidator(rules)
val_result = valid.validate_object(data1)
if not val_result[VALIDATION_RESULT.VALID]:
    errors = val_result[VALIDATION_RESULT.ERRORS]
    raise ParamInvalidError(LANG.VALIDATE_ERROR, errors)

data1 --> OK
data2 --> Fail, key1 must be present

Metadata

Release files for m-validator 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for m-validator 0.1
File Size Uploaded Provenance
m-validator-0.1.tar.gz 8.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for m-validator 0.1
File Interpreter ABI Platform
m_validator-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.8 kB

Release files / m-validator-0.1.tar.gz

Download URL m-validator-0.1.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6c52b99128ad37d443f185ea72c35ff47e6fcaabed1350c60f1db68d6770da53
BLAKE2b-256 checksum
How to use checksums
cf1bb498faa04bc0bdbda4effa2b82b94c0c22f383e4b9e81eec7318bc8515d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1

Release files / m_validator-0.1-py3-none-any.whl

Download URL m_validator-0.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc86fe73cc045ee00d9611f340db5ffbbdcb4adc9e077c1742111910f0c72e1d
BLAKE2b-256 checksum
How to use checksums
4c0caa572385a00c1c75ce5783848d226b5a21fd39323c75e456a380c4cf4c5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.1

Security for m-validator 0.1

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.

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page