Skip to main content

Validates password according to flexible and intuitive specifications

Project description

logo
pypi version build coverage format status python version

password_validator

This is a python port of npm package password-validator.

Install

pip install password-validator

Usage

from password_validator import PasswordValidator

# Create a schema
schema = PasswordValidator()

# Add properties to it
schema\
.min(8)\
.max(100)\
.has().uppercase()\
.has().lowercase()\
.has().digits()\
.has().no().spaces()\

# Validate against a password string
print(schema.validate('validPASS123'));
# => True
print(schema.validate('invalidPASS'));
# => False

Rules

Rules supported as of now are:

Rules

Descriptions

digits()

specifies password must include digits

letters()

specifies password must include letters

lowercase()

specifies password must include lowercase letters

uppercase()

specifies password must include uppercase letters

symbols()

specifies password must include symbols

spaces()

specifies password must include spaces

min(len)

specifies minimum length

max(len)

specifies maximum length

no([regex])

inverts the result of validations applied next

has([regex])

inverts the effect of no() and applies a regex (optional)

License

MIT License

Project details


Download files

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

Source Distribution

password_validator-1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

password_validator-1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file password_validator-1.0.tar.gz.

File metadata

  • Download URL: password_validator-1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for password_validator-1.0.tar.gz
Algorithm Hash digest
SHA256 f12c1036b17c67fab607ad8003f43e73940793d7ab89bc7efcb2cd47c024533b
MD5 3d9021b1dd75eaeec1a82f15af80065d
BLAKE2b-256 1f603529640092041a8d46e9c88cdcd6d00f212b3e38e398d4c167eec549fc46

See more details on using hashes here.

File details

Details for the file password_validator-1.0-py3-none-any.whl.

File metadata

  • Download URL: password_validator-1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for password_validator-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4de1758e15b4e9bdf32933fcc99ce89efcdd28566e26e130726bb4295dd0d44c
MD5 d3a8deaaf52120416842490cae8701f1
BLAKE2b-256 b814b65256d9f801d172a815adf003892b034fe6dbadec7b9def4f45309a7a56

See more details on using hashes here.

Supported by

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