Skip to main content

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/


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 

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

If you're not sure about the file name format, learn more about wheel file names.

onelinevalidation-0.3.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file onelinevalidation-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for onelinevalidation-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0780eb6e195b24e8bfc3981aa6f45e9750077ae083e4e8f805e96369af408760
MD5 24f5c2628b15f248d1be8ff2810e92d5
BLAKE2b-256 e856e8f8fb9f8fa3de1110039c42099b89bc145d257551258911f12466e958f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page