pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python-validators/validators/blob/master/docs/install_and_use.md

ts/global-0bd78641c0a1f3e0.css" /> validators/docs/install_and_use.md at master · python-validators/validators · GitHub
Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.28 KB

File metadata and controls

43 lines (32 loc) · 1.28 KB

Install and Use

Installation

Execute the following command:

pip install validators

It's preferable to use pip within a virtual environment.

Usage

import validators
print(validators.email('someone@example.com'))

To raise validation error

  1. 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'})
  2. 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'})
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy