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.3.tar.gz
(4.1 kB
view details)
File details
Details for the file urlnorm-1.1.3.tar.gz
.
File metadata
- Download URL: urlnorm-1.1.3.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9ea4ed056716df565ecbc34bc2b024970368a91e496009089cb54abea010059 |
|
MD5 | cde56c43b07ae41dc626e224a34a944f |
|
BLAKE2b-256 | bfa194dc13d498688e23110269dfb5fcdc23251808deec78dd80fb72ccc94725 |