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 urlnorm
Example
>>> 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.1.4.tar.gz
(4.3 kB
view details)
File details
Details for the file urlnorm-1.1.4.tar.gz
.
File metadata
- Download URL: urlnorm-1.1.4.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cde99b7ec8edb6768dfecbed5d97e9bd0c784b0593ee28a3f83b20419dcd75e |
|
MD5 | f762869fae60386e54bbb209fd3a986e |
|
BLAKE2b-256 | 4d462bbc8d92698b72c44099e215cdaff85a7c27c64fbcf74aa8e313a4da36fe |