Skip to main content
Help us improve Python packaging – donate today!

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 urisplit, uriunsplit, urijoin, uridefrag
>>> uri = urisplit('foo://example.com:8042/over/there?name=ferret#nose')
>>> uri
SplitResult(scheme='foo', authority='example.com:8042', path='/over/there',
            query='name=ferret', fragment='nose')
>>> uri.scheme
'foo'
>>> uri.authority
'example.com:8042'
>>> uri.host
'example.com'
>>> uri.port
8042
>>> uri.geturi()
'foo://example.com:8042/over/there?name=ferret#nose'
>>> uriunsplit(uri[:3] + ('name=swallow&type=African', 'beak'))
'foo://example.com:8042/over/there?name=swallow&type=African#beak'
>>> urijoin('http://www.cwi.nl/~guido/Python.html', 'FAQ.html')
'http://www.cwi.nl/~guido/FAQ.html'
>>> uridefrag('http://pythonhosted.org/uritools/index.html#constants')
DefragResult(base='http://pythonhosted.org/uritools/index.html',
             fragment='constants')
>>> urisplit('http://www.xn--lkrbis-vxa4c.at/').gethost(encoding='idna')
'www.ölkürbis.at'

For various reasons, the urlparse module is not compliant with current Internet standards, does not include Unicode support, and is generally unusable with proprietary URI schemes. As stated in Lib/urlparse.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, plus additional functions for handling Unicode, normalizing URI paths, and conveniently composing URIs from their individual components.

Installation

Install uritools using pip:

pip install uritools

License

Copyright (c) 2014 Thomas Kemmer.

Licensed under the MIT License.

Known Bugs and Limitations

This modules does not handle IPv6 host addresses (yet).

Release history Release notifications

History Node

2.1.0

History Node

2.0.1

History Node

2.0.0

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

History Node

0.12.0

History Node

0.11.1

History Node

0.11.0

History Node

0.10.1

History Node

0.10.0

History Node

0.9.0

History Node

0.8.0

History Node

0.7.0

History Node

0.6.0

This version
History Node

0.5.2

History Node

0.5.1

History Node

0.5.0

History Node

0.4.0

History Node

0.3.0

History Node

0.2.1

History Node

0.2.0

History Node

0.1.0

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
uritools-0.5.2.tar.gz (16.1 kB) Copy SHA256 hash SHA256 Source None Aug 7, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page