Skip to main content

Additional parameter types for the "click" module that I find useful.

Project description

clicktypes

Additional types for the click module that I find useful.

For a list of available types check the README file from the module.

Installation

Install from PyPI:

## Python 3
python3 -m pip install clicktypes

## PyPy3
pypy3 -m pip install clicktypes

Examples

The following are some examples. For complete examples check the appropriate README.

Networking

If you accept an IP address parameter:

from clicktypes.network import IPAddressParam

@click.argument(
    'ip',
    nargs           = -1,
    required        = True,
    type            = IPAddressParam(),
)

This will validate the IP or IP's provided are IPv4 or IPv6 addresses and return them as an IPv4Address or IPv6Address object.

Web

If you accept an email address parameter:

from clicktypes.web import EmailParam

@click.argument(
    'email',
    nargs           = -1,
    required        = True,
    type            = EmailParam(),
)

This will validate the email address provided matches an approved regex and it will convert it to lowercase.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for clicktypes, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size clicktypes-0.0.4.tar.gz (5.7 kB) File type Source Python version None Upload date Hashes View
Filename, size clicktypes-0.0.4-py2.py3-none-any.whl (7.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page