| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
Execute the following command:
pip install validators
It's preferable to use pip within a virtual environment.
import validators
print(validators.email('someone@example.com'))Either set the environment variable RAISE_VALIDATION_ERROR to True
$ export RAISE_VALIDATION_ERROR=True
$ python -c "from validators import url; print(url('https//bad_url'))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/path/to/lib/validators/utils.py", line 87, in wrapper
raise ValidationError(func, _func_args_as_dict(func, *args, **kwargs))
validators.utils.ValidationError: ValidationError(func=url, args={'value': 'https//bad_url'})Or pass r_ve=True to each caller function:
$ python -c "from validators.card import visa; print(visa('bad_visa_number', r_ve=True))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/path/to/lib/validators/utils.py", line 87, in wrapper
raise ValidationError(func, _func_args_as_dict(func, *args, **kwargs))
validators.utils.ValidationError: ValidationError(func=visa, args={'value': 'bad_visa_number'})| Back | FazBrowse Home | New Git URL |