Normalize a URL to a standard unicode encoding
Project description
urlnorm.py
Normalize a URL to a standard unicode representation
urlnorm normalizes a URL by:
lowercasing the scheme and hostname
converting the hostname to IDN format
taking out default port if present (e.g., http://www.foo.com:80/)
collapsing the path (./, ../, etc)
removing the last character in the hostname if it is ‘.’
unquoting any % escaped characters (where possible)
Installation
pip install -U urlnorm
or to install from source
pip install -e git://github.com/jehiah/urlnorm.git#egg=urlnorm
Examples
>>> import urlnorm >>> urlnorm.norm("http://xn--q-bga.com./u/u/../%72/l/") u'http://q\xe9.com/u/r/l/'
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
urlnorm-1.0.1.tar.gz
(3.8 kB
view details)
File details
Details for the file urlnorm-1.0.1.tar.gz
.
File metadata
- Download URL: urlnorm-1.0.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce2db27cb7c03cfda5432a395a91ca018b60cffdc5cbe778f5afbf7425fcac6c |
|
MD5 | 0827d7707ee9e21c3fe80cf433de8c0e |
|
BLAKE2b-256 | 4281c0248f5b1da43fdf60696a4f0a95319f6e2d9411f8f44141cb7b88423a24 |