Disinfect: Destroy bad input.
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Disinfect-0.2.1.tar.gz
(14.7 kB
view details)
Built Distribution
File details
Details for the file Disinfect-0.2.1.tar.gz
.
File metadata
- Download URL: Disinfect-0.2.1.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 721baa30cf9bc05130f01ed7bd5f917ff0f201e9c1903204187739a82014c310 |
|
MD5 | 25c4b05867e507c762247a4dd5ad422e |
|
BLAKE2b-256 | 112787c79f2e4415feaffb9e2da96b26f273f54a2a548a3ed03d23d86e915898 |
File details
Details for the file Disinfect-0.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: Disinfect-0.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2590c6786580746c3fd18bbb977b98d212e1653f51acc878337720778b0f4b95 |
|
MD5 | 1e179d3a755ca60c4c53d7e84cf3ea8e |
|
BLAKE2b-256 | b4d132c332377471252d9239dda64d2824cca44c13d9b0bed537f0f9f9a08b40 |