Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python cerberus

#!/usr/bin/env python

from cerberus import Validator

v = Validator()
v.schema = {'name': { 'type': 'string', 'minlength': 25},
    'age': {'type': 'integer', 'min': 18, 'max': 65}}

if v.validate({'name': 'codecaine', 'age': 4}):
    print('valid data')
else:
    print('invalid data')
    print(v.errors)
Source by zetcode.com #
 
PREVIOUS NEXT
Tagged: #python #cerberus
ADD COMMENT
Topic
Name
2+5 =