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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size Disinfect-0.2.1-py2.py3-none-any.whl (7.3 kB) | File type Wheel | Python version py2.py3 | Upload date | Hashes View |
Filename, size Disinfect-0.2.1.tar.gz (14.7 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for Disinfect-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2590c6786580746c3fd18bbb977b98d212e1653f51acc878337720778b0f4b95 |
|
MD5 | 1e179d3a755ca60c4c53d7e84cf3ea8e |
|
BLAKE2-256 | b4d132c332377471252d9239dda64d2824cca44c13d9b0bed537f0f9f9a08b40 |