RFC 3986 compliant, Unicode-aware, scheme-agnostic replacement for urlparse
Project description
This module defines RFC 3986 compliant replacements for the most commonly used functions of the Python 2.7 Standard Library urlparse and Python 3 urllib.parse modules.
>>> from uritools import uricompose, urijoin, urisplit, uriunsplit
>>> uricompose(scheme='foo', host='example.com', port=8042,
... path='/over/there', query={'name': 'ferret'},
... fragment='nose')
'foo://example.com:8042/over/there?name=ferret#nose'
>>> parts = urisplit(_)
>>> parts.scheme
'foo'
>>> parts.authority
'example.com:8042'
>>> parts.getport(default=80)
8042
>>> parts.getquerydict().get('name')
['ferret']
>>> urijoin(uriunsplit(parts), '/right/here?name=swallow#beak')
'foo://example.com:8042/right/here?name=swallow#beak'
For various reasons, the Python 2 urlparse module is not compliant with current Internet standards, does not include Unicode support, and is generally unusable with proprietary URI schemes. Python 3’s urllib.parse improves on Unicode support, but the other issues still remain. As stated in Lib/urllib/parse.py:
RFC 3986 is considered the current standard and any future changes to urlparse module should conform with it. The urlparse module is currently not entirely compliant with this RFC due to defacto scenarios for parsing, and for backward compatibility purposes, some parsing quirks from older RFCs are retained.
This module aims to provide fully RFC 3986 compliant replacements for some commonly used functions found in urlparse and urllib.parse, plus additional functions for conveniently composing URIs from their individual components.
Installation
Install uritools using pip:
pip install uritools
Project Resources
License
Copyright (c) 2014-2018 Thomas Kemmer.
Licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file uritools-2.1.1.tar.gz
.
File metadata
- Download URL: uritools-2.1.1.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64369ece6f5c6ab18cba2cd0b199da40ffb9390493da1ff5c1d94b6ed107b401 |
|
MD5 | d3788cb68e8aea3ddc5c7f417b1d754b |
|
BLAKE2b-256 | d8f5ff4186486837bb4ab5f1dde7788caec39c0b8355ac2e79258e20068cf456 |
File details
Details for the file uritools-2.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: uritools-2.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e93e8e3ad1797ce76f1053e914549ea294fdd39158edafa067ef5850bbc9ac06 |
|
MD5 | 537b91a95d73593e36a0fe678a027615 |
|
BLAKE2b-256 | 27895dddc3cd5d48746f0ce6c962f1275d0a1773fd94d3a79f1031b8b0ecac33 |