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.2.tar.gz
(4.2 kB
view details)
File details
Details for the file urlnorm-1.1.2.tar.gz
.
File metadata
- Download URL: urlnorm-1.1.2.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 944b366eef37b5c99bcff10e1d1ae7f30cfeffb1eb4af16b1906d9127f467ab2 |
|
MD5 | e6544d41a4e992296ee8895873b472bf |
|
BLAKE2b-256 | 214551ad54db30d86064fb6c54c11094bf2b9ee93a82b9880e7ae1639160b638 |