Laravel style input validation for Python.
Project description
Python Validator
Laravel style input validation for Python.
Installation
Python Validator can be installed via pip:
pip install spotlight
Usage
from spotlight import Validator
Simple Input Examples
rules = {
"email": "required|email",
"first_name": "required|string|max:255",
"last_name": "required|string|max:255",
"password": "required|min:8|max:255"
}
input = {
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"password": "test1234"
}
validator = Validator()
errors = validator.validate(input, rules)
Unique & Exists Examples
rules = {
"id": "exists:user,id",
"email": "unique:user,email"
}
input = {
"id": 1,
"email": "john.doe@example.com"
}
validator = Validator()
errors = validator.validate(input, rules)
More examples coming soon...
Available Rules
- required
- required_without
- required_with
- required_if
- not_with
- filled
- url
- ip
- min
- max
- in
- alpha_num
- alpha_num_space
- string
- integer
- boolean
- uuid4
- unique (database)
- exists (database)
Custom Rules
Docs coming soon...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spotlight-0.1.2.tar.gz
(12.3 kB
view hashes)
Built Distribution
spotlight-0.1.2-py3-none-any.whl
(24.6 kB
view hashes)
Close
Hashes for spotlight-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbde368a4400bf40db25dc88918f79493ada1ca0703458a9e86b446cf9616fcd |
|
MD5 | f14daaefa699fe1b8ae71d989c6bb072 |
|
BLAKE2b-256 | 44fd53a40343c09c032a0d97d63aca733944d2902f186ac15942f4f75cb71914 |