URL normalization for Python (python2)
Project description
url-normalize
=============
URI Normalization function:
* Take care of IDN domains.
* Always provide the URI scheme in lowercase characters.
* Always provide the host, if any, in lowercase characters.
* Only perform percent-encoding where it is essential.
* Always use uppercase A-through-F characters when percent-encoding.
* Prevent dot-segments appearing in non-relative URI paths.
* For schemes that define a default authority, use an empty authority if the default is desired.
* For schemes that define an empty path to be equivalent to a path of "/", use "/".
* For schemes that define a port, use an empty port if the default is desired
* All portions of the URI must be utf-8 encoded NFC from Unicode strings
Inspired by Sam Ruby's urlnorm.py: http://intertwingly.net/blog/2004/08/04/Urlnorm
Example:
```
$ pip install git+git://github.com/niksite/url-normalize.git
Installing collected packages: url-normalize
Running setup.py install for url-normalize
Successfully installed url-normalize-1.2
$ python
Python 2.7.11 (default, Dec 8 2015, 23:51:37)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
> from url_normalize import url_normalize
> print url_normalize('www.foo.com:80/foo')
> http://www.foo.com/foo
```
History:
* 29 Dec 2015: PEP8, setup.py
* 10 Mar 2010: support for shebang (#!) urls
* 28 Feb 2010: using 'http' schema by default when appropriate
* 28 Feb 2010: added handling of IDN domains
* 28 Feb 2010: code pep8-zation
* 27 Feb 2010: forked from Sam Ruby's urlnorm.py
=============
URI Normalization function:
* Take care of IDN domains.
* Always provide the URI scheme in lowercase characters.
* Always provide the host, if any, in lowercase characters.
* Only perform percent-encoding where it is essential.
* Always use uppercase A-through-F characters when percent-encoding.
* Prevent dot-segments appearing in non-relative URI paths.
* For schemes that define a default authority, use an empty authority if the default is desired.
* For schemes that define an empty path to be equivalent to a path of "/", use "/".
* For schemes that define a port, use an empty port if the default is desired
* All portions of the URI must be utf-8 encoded NFC from Unicode strings
Inspired by Sam Ruby's urlnorm.py: http://intertwingly.net/blog/2004/08/04/Urlnorm
Example:
```
$ pip install git+git://github.com/niksite/url-normalize.git
Installing collected packages: url-normalize
Running setup.py install for url-normalize
Successfully installed url-normalize-1.2
$ python
Python 2.7.11 (default, Dec 8 2015, 23:51:37)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
> from url_normalize import url_normalize
> print url_normalize('www.foo.com:80/foo')
> http://www.foo.com/foo
```
History:
* 29 Dec 2015: PEP8, setup.py
* 10 Mar 2010: support for shebang (#!) urls
* 28 Feb 2010: using 'http' schema by default when appropriate
* 28 Feb 2010: added handling of IDN domains
* 28 Feb 2010: code pep8-zation
* 27 Feb 2010: forked from Sam Ruby's urlnorm.py
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
url-normalize-1.2.1.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for url_normalize-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 144e4503b7cfa9bed5f76575685a746e0af52a5238066e6efdb284ffd623681d |
|
MD5 | ff36e862fd15e8ee76d4187a81fbe64a |
|
BLAKE2b-256 | a10aa3d17ffe2eb36be0ea1ae2843b2429441b5e239c0d5d51f065c76877a317 |