RFC 3986 compliant, Unicode-aware, scheme-agnostic replacement for urlparse

uri url urlparse urlsplit urljoin urldefrag
pip install uritools==2.2.0



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')
>>> parts = urisplit(_)
>>> parts.scheme
>>> parts.authority
>>> parts.getport(default=80)
>>> parts.getquerydict().get('name')
>>> urijoin(uriunsplit(parts), '/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.


Install uritools using pip:

pip install uritools

Project Resources

Latest PyPI version Travis CI build status Test coverage Documentation Status


Copyright (c) 2014-2018 Thomas Kemmer.

Licensed under the MIT License.