url-normalize
=============
[![Build Status](https://travis-ci.org/niksite/url-normalize.svg?branch=master)](https://travis-ci.org/niksite/url-normalize)
[![Coverage Status](https://coveralls.io/repos/github/niksite/url-normalize/badge.svg?branch=master)](https://coveralls.io/github/niksite/url-normalize?branch=master)
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:
```sh
$ pip install url-normalize
Collecting url-normalize
...
Successfully installed future-0.16.0 url-normalize-1.3.3
$ python
Python 3.6.1 (default, Jul 8 2017, 05:00:20)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
> from url_normalize import url_normalize
> print(url_normalize('www.foo.com:80/foo'))
> https://www.foo.com/foo
```
History:
* 1.4.3: Added LICENSE file
* 1.4.2: Added an optional param sort_query_params (True by default)
* 1.4.1: Added an optional param default_scheme to the url_normalize ('https' by default)
* 1.4.0: A bit of code refactoring and cleanup
* 1.3.3: Support empty string and double slash urls (//domain.tld)
* 1.3.2: Same code support both Python 3 and Python 2.
* 1.3.1: Python 3 compatibility
* 1.2.1: PEP8, setup.py
* 1.1.2: support for shebang (#!) urls
* 1.1.1: using 'http' schema by default when appropriate
* 1.1.0: added handling of IDN domains
* 1.0.0: code pep8
* 0.1.0: forked from Sam Ruby's urlnorm.py
License: MIT License
Raw data
{
"_id": null,
"home_page": "https://github.com/niksite/url-normalize",
"name": "url-normalize",
"maintainer": "",
"docs_url": null,
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*",
"maintainer_email": "",
"keywords": "url,normalization,normalize",
"author": "Nikolay Panov",
"author_email": "github@npanov.com",
"download_url": "https://files.pythonhosted.org/packages/ec/ea/780a38c99fef750897158c0afb83b979def3b379aaac28b31538d24c4e8f/url-normalize-1.4.3.tar.gz",
"platform": "",
"description": "url-normalize\n=============\n\n[![Build Status](https://travis-ci.org/niksite/url-normalize.svg?branch=master)](https://travis-ci.org/niksite/url-normalize)\n[![Coverage Status](https://coveralls.io/repos/github/niksite/url-normalize/badge.svg?branch=master)](https://coveralls.io/github/niksite/url-normalize?branch=master)\n\nURI Normalization function:\n\n* Take care of IDN domains.\n* Always provide the URI scheme in lowercase characters.\n* Always provide the host, if any, in lowercase characters.\n* Only perform percent-encoding where it is essential.\n* Always use uppercase A-through-F characters when percent-encoding.\n* Prevent dot-segments appearing in non-relative URI paths.\n* For schemes that define a default authority, use an empty authority if the default is desired.\n* For schemes that define an empty path to be equivalent to a path of \"/\", use \"/\".\n* For schemes that define a port, use an empty port if the default is desired\n* All portions of the URI must be utf-8 encoded NFC from Unicode strings\n\nInspired by Sam Ruby's [urlnorm.py](http://intertwingly.net/blog/2004/08/04/Urlnorm)\n\nExample:\n\n```sh\n$ pip install url-normalize\nCollecting url-normalize\n...\nSuccessfully installed future-0.16.0 url-normalize-1.3.3\n$ python\nPython 3.6.1 (default, Jul 8 2017, 05:00:20)\n[GCC 4.9.2] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n> from url_normalize import url_normalize\n> print(url_normalize('www.foo.com:80/foo'))\n> https://www.foo.com/foo\n```\n\nHistory:\n\n* 1.4.3: Added LICENSE file\n* 1.4.2: Added an optional param sort_query_params (True by default)\n* 1.4.1: Added an optional param default_scheme to the url_normalize ('https' by default)\n* 1.4.0: A bit of code refactoring and cleanup\n* 1.3.3: Support empty string and double slash urls (//domain.tld)\n* 1.3.2: Same code support both Python 3 and Python 2.\n* 1.3.1: Python 3 compatibility\n* 1.2.1: PEP8, setup.py\n* 1.1.2: support for shebang (#!) urls\n* 1.1.1: using 'http' schema by default when appropriate\n* 1.1.0: added handling of IDN domains\n* 1.0.0: code pep8\n* 0.1.0: forked from Sam Ruby's urlnorm.py\n\nLicense: MIT License\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "URL normalization for Python",
"version": "1.4.3",
"split_keywords": [
"url",
"normalization",
"normalize"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "0604cdf11e78b0e5746fb7909dceb258",
"sha256": "ec3c301f04e5bb676d333a7fa162fa977ad2ca04b7e652bfc9fac4e405728eed"
},
"downloads": -1,
"filename": "url_normalize-1.4.3-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "0604cdf11e78b0e5746fb7909dceb258",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*",
"size": 6804,
"upload_time": "2020-10-26T02:07:13",
"upload_time_iso_8601": "2020-10-26T02:07:13.218554Z",
"url": "https://files.pythonhosted.org/packages/65/1c/6c6f408be78692fc850006a2b6dea37c2b8592892534e09996e401efc74b/url_normalize-1.4.3-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "3e72f94de0c4a98f8ea76cd99cf105d9",
"sha256": "d23d3a070ac52a67b83a1c59a0e68f8608d1cd538783b401bc9de2c0fac999b2"
},
"downloads": -1,
"filename": "url-normalize-1.4.3.tar.gz",
"has_sig": false,
"md5_digest": "3e72f94de0c4a98f8ea76cd99cf105d9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*",
"size": 6024,
"upload_time": "2020-10-26T02:07:11",
"upload_time_iso_8601": "2020-10-26T02:07:11.438904Z",
"url": "https://files.pythonhosted.org/packages/ec/ea/780a38c99fef750897158c0afb83b979def3b379aaac28b31538d24c4e8f/url-normalize-1.4.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-10-26 02:07:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "niksite",
"github_project": "url-normalize",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "url-normalize"
}