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/


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

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

onelinevalidation-0.4.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for onelinevalidation-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0bfe2ca8455d9de8644d480a5f079f46b245dc00c9f6c152af2c9b669fd326d7
MD5 473da248b7c1f98c5b6ba4dde24bfe8d
BLAKE2b-256 5eadf712577ebd19dc3f65bb22fd3d6249151020acca2c5bf6169e7cd3da43dd

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