onelinevalidation It is a simple library in the Python language that performs validate in an easy and simple way
Project description
onelinevalidation
onelinevalidation It is a simple library in the Python language that performs validate in an easy and simple way
Installation
- From PyPi
python pip install onelinevalidation
Examples
In default sanitize = True
in validate_form
and custom_validate
This is to prevent a Cross-site Scripting vulnerability
For more https://owasp.org/www-community/attacks/xss/
from onelinevalidation import validate_form
userData = {"username": "amr123", "email": "amr.@aol.com", "password": "123Ab#"}
print(validate_form(userData))
-------------------------
{'username': 'Invalid username should be like this abc_123 or abc. abc',
'email': 'This email address is not valid',
'password': 'The password length must be at least 8 uppercase, lowercase letters, numbers, symbols like @aA123#*'
}
## If you want more control use custom_validate
from onelinevalidation import custom_validate
pattrens = [
"[a-zA-Z]+[_.]+[a-zA-Z0-9]+",
"[a-zA-Z0-9_-]+[@](aol|gmail|yahoo|outlook)+(.com)+",
"^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$"
]
messages = [
"Invalid username should be like this abc_123 or abc. abc",
"This email address is not valid",
"The password length must be at least 8 uppercase, lowercase letters, numbers, symbols like @aA123#*"
]
print(custom_validate(userData, pattrens, messages))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onelinevalidation-0.4.0-py3-none-any.whl.
File metadata
- Download URL: onelinevalidation-0.4.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bfe2ca8455d9de8644d480a5f079f46b245dc00c9f6c152af2c9b669fd326d7
|
|
| MD5 |
473da248b7c1f98c5b6ba4dde24bfe8d
|
|
| BLAKE2b-256 |
5eadf712577ebd19dc3f65bb22fd3d6249151020acca2c5bf6169e7cd3da43dd
|