Skip to main content

pathvalidate is a python library to validate/sanitize a string such as filename/variable-name.

Project description

pathvalidate

https://img.shields.io/pypi/pyversions/pathvalidate.svg https://travis-ci.org/thombashi/pathvalidate.svg?branch=master https://coveralls.io/repos/github/thombashi/pathvalidate/badge.svg?branch=master

Summary

pathvalidate is a python library to validate/sanitize a string such as filename/variable-name.

Examples

Filename validation

import pathvalidate

filename = "a*b:c<d>e%f(g)h+i_0.txt"
try:
    pathvalidate.validate_filename(filename)
except ValueError:
    print("invalid filename!")
invalid filename!

Sanitize a file path

import pathvalidate

filename = "a*b:c<d>e%f(g)h+i_0.txt"
print(pathvalidate.sanitize_filename(filename))
abcde%f(g)h+i_0.txt

For more information

More examples are available at http://pathvalidate.readthedocs.org/en/latest/pages/examples/index.html

Installation

pip install pathvalidate

Dependencies

Python 2.6+ or 3.3+

Test dependencies

Documentation

http://pathvalidate.readthedocs.org/en/latest/

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pathvalidate-0.2.0.tar.gz (886.2 kB view details)

Uploaded Source

Built Distribution

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

pathvalidate-0.2.0-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pathvalidate-0.2.0.tar.gz.

File metadata

  • Download URL: pathvalidate-0.2.0.tar.gz
  • Upload date:
  • Size: 886.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pathvalidate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b9dd6993c32aa4a02b8e226b9694e8eb6f6f9df63e145f731346048d754be706
MD5 164d51c0b40a0a7c333e49722fc52557
BLAKE2b-256 0e108b050edde46970d887c8464d11f2c056cec0dc7e918ce5ac4550c21e8b75

See more details on using hashes here.

File details

Details for the file pathvalidate-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pathvalidate-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 93a2c998ebea9a177df0bd4b41baff6ade34bf313cd8cf7ad994015e63e63057
MD5 340db3395428be796ad0c4c5c1367dc0
BLAKE2b-256 0950843dfae240ee8afa74d6af7e992105d52264ee0eba18086a9b813e0bd74b

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