<commit_before>cleancat
========

Validation library for Python designed to be used with JSON REST frameworks<commit_msg>Super basic example in README; Closes #5<commit_after>cleancat
========

Validation library for Python designed to be used with JSON REST frameworks


### Basic example in Flask

```
class JobApplication(Schema):
    first_name = String()
    last_name = String()
    email = Email()
    urls = List(URL(default_scheme='http://'))

@app.route('/job_application', methods=['POST'])
@mimerender(default='json', json=render_json)
def test_view():
    schema = JobApplication(request.json)
    try:
        data = schema.full_clean()
    except SchemaValidationError:
        return {'field-errors': schema.field_errors, 'errors': schema.errors }, '400 Bad Request'
        
    # Now "data" has the validated data
```
{'fraction_non_alphanumeric': 0.12934131736526946, 'fraction_numerical': 0.004790419161676647, 'mean_word_length': 4.32484076433121, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6996125', 'n_tokens_mistral': 242, 'n_tokens_neox': 230, 'n_words': 72}