Disinfect allows you to validate and sanitize incoming data.
Free software: MIT license
Documentation: http://documentation.creeer.io/disinfect/
Source-code: https://github.com/corverdevelopment/disinfect/
A quick example:
import disinfect as d
mapping = d.Mapping({
'first': d.String(),
Field('infix', default=''): d.String(min_len=0,
max_len=40),
'last': d.String(),
'addresses': d.ListOf(Mapping({
'zipcode': d.String(min_len=5, max_len=5),
'housenumber': d.Int(min_value=1),
}))
})
user = mapping({
'first': 'Nils',
'last': 'Corver',
'addresses': [
{'zipcode': '71486', 'housenumber': '49'},
{'zipcode': '59546', 'housenumber': '709'},
]
})
assert user == {
'first': 'Nils',
'infix': '',
'last': 'Corver',
'addresses': [
{'zipcode': '71486', 'housenumber': 49},
{'zipcode': '59546', 'housenumber': 709},
]
}
with raises(d.MultiValueError) as exc:
mapping({})
assert exc.value.to_dict() == {
'first': 'Field is required.',
'last': 'Field is required.',
'addresses': 'Field is required.',
}
Features
TODO
Metadata
Release files for Disinfect 0.2.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 | |
|---|---|---|---|
| Disinfect-0.2.1.tar.gz | 14.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Disinfect-0.2.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 22.0 kB
Release files / Disinfect-0.2.1.tar.gz
| Download URL | Disinfect-0.2.1.tar.gz |
|---|---|
| Size | 14.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
721baa30cf9bc05130f01ed7bd5f917ff0f201e9c1903204187739a82014c310
|
|
BLAKE2b-256 checksum How to use checksums |
112787c79f2e4415feaffb9e2da96b26f273f54a2a548a3ed03d23d86e915898
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / Disinfect-0.2.1-py2.py3-none-any.whl
| Download URL | Disinfect-0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2590c6786580746c3fd18bbb977b98d212e1653f51acc878337720778b0f4b95
|
|
BLAKE2b-256 checksum How to use checksums |
b4d132c332377471252d9239dda64d2824cca44c13d9b0bed537f0f9f9a08b40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |