Skip to main content

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

Latest PyPI version Travis CI build status Test coverage

License

Copyright (c) 2014-2016 Thomas Kemmer.

Licensed under the MIT License.

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

uritools-2.0.0.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

uritools-2.0.0-py2.py3-none-any.whl (13.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file uritools-2.0.0.tar.gz.

File metadata

  • Download URL: uritools-2.0.0.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for uritools-2.0.0.tar.gz
Algorithm Hash digest
SHA256 20d7881a947cd3c3bb452e2b541f44acc52febe9c4e3f6d05c55d559fb208c50
MD5 0142c6a035df53b37bca67ce172beb50
BLAKE2b-256 7dc9f6bd900266615785adbd3f6ab51b0259dcefba770535439e744302dd0a28

See more details on using hashes here.

File details

Details for the file uritools-2.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for uritools-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 377366e8a864359766a496c3d9eb2e170450a85ec25c358b74eb806bf4daa5e7
MD5 5c33d6e6a202fe292ad7ea9cd89aabd6
BLAKE2b-256 b7f56db441cb2d930a5dd2a062ae68510125fed7cb97c1ac78b57452dcccf95e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page