Skip to main content

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

Project description

Latest PyPI version Number of PyPI downloads

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

For various reasons, the standard library urlparse module is not compliant with current Internet standards, does not provide 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, Unicode-aware replacements for the most commonly used functions provided by urlparse.

The uritools module currently defines the following functions:

uritools.urisplit(uristring)

Split a URI string into a named tuple with five components:

<scheme>://<authority>/<path>?<query>#<fragment>

The returned object is an instance of SplitResult.

uritools.uriunsplit(parts)

Combine the elements of a tuple as returned by urisplit() into a complete URI as a string.

The parts argument can be any five-item iterable.

uritools.uricompose(scheme=None, authority=None, path=’’, query=None, fragment=None, encoding=’utf-8’)

Compose a URI string from its components.

class uritools.SplitResult(scheme, authority, path, query, fragment)

Extend namedtuple to hold urisplit() results.

Attributes:
scheme:

URI scheme or None if not present

authority:

URI authority component or None if not present

path:

URI path component, always present but may be empty

query:

URI query component or None if not present

fragment:

URI fragment component or None if not present

Changelog

v0.0.4 (2014-02-09)

  • Add default parameters.

  • Improve RFC 3986 compliance.

  • Adapt unit tests from urlparse.

  • Write some documentation.

v0.0.3 (2014-02-08)

  • Add character encoding parameters.

v0.0.2 (2014-02-08)

  • Add basic unit tests.

v0.0.1 (2014-02-08)

  • Initial alpha release.

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-0.0.4.tar.gz (5.8 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for uritools-0.0.4.tar.gz
Algorithm Hash digest
SHA256 3055393e4849675f38d63914028bea31ebb5e3343e9ab06dbbc01de9035846ca
MD5 193996a4d216b4c6d35bac911aab2faf
BLAKE2b-256 5de1fde0a02a2044ea01c8e9a4600718f4f188506027a524b9e98b1ec5f7060b

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