RETIRED, further work has moved to Debian project infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ian Stapleton Cordasco 5fb3fab7e8
Bump version to 1.1.0
4 years ago
docs/source Add release notes for v1.1.0 4 years ago
src/rfc3986 Bump version to 1.1.0 4 years ago
tests Merge pull request #27 from sigmavirus24/moar-validation 4 years ago
.coveragerc Exclude solitary line from coverage 4 years ago
.gitignore Add docs testenv and proper gitignores 6 years ago
.travis.yml Fix up .travis.yaml for new support matrix 4 years ago
AUTHORS.rst Work to actually publish this library 7 years ago
LICENSE Least useful initial commit ever 7 years ago
MANIFEST.in Add release notes to our documentation 4 years ago
README.rst Start seriously working on documentation 4 years ago
dev-requirements.txt Let pytest-cov handle enforcing 100% testcov 6 years ago
setup.cfg Add missing setup.cfg file 6 years ago
setup.py Add release notes to our documentation 4 years ago
tox.ini Fix documentation builds on RTD 4 years ago

README.rst

rfc3986

A Python implementation of RFC 3986 including validation and authority parsing.

Installation

Use pip to install rfc3986 like so:

pip install rfc3986

License

Apache License Version 2.0

Example Usage

The following are the two most common use cases envisioned for rfc3986.

Replacing urlparse

To parse a URI and receive something very similar to the standard library's urllib.parse.urlparse

To create a copy of it with new pieces you can use copy_with:

Strictly Parsing a URI and Applying Validation

To parse a URI into a convenient named tuple, you can simply:

With a parsed URI you can access data about the components:

It can also parse URIs with unicode present:

With a parsed URI you can also validate it:

You can also take a parsed URI and normalize it:

But these two URIs are (functionally) equivalent:

Your paths, queries, and fragments are safe with us though:

If you do not actually need a real reference object and just want to normalize your URI:

You can also very simply validate a URI:

Requiring Components

You can validate that a particular string is a valid URI and require independent components:

If you have an instance of a URIReference, you can pass the same arguments to URIReference#is_valid, e.g.,

Alternatives

  • rfc3987

    This is a direct competitor to this library, with extra features, licensed under the GPL.

  • uritools

    This can parse URIs in the manner of RFC 3986 but provides no validation and only recently added Python 3 support.

  • Standard library's urlparse/urllib.parse

    The functions in these libraries can only split a URI (valid or not) and provide no validation.

Contributing

This project follows and enforces the Python Software Foundation's Code of Conduct.

If you would like to contribute but do not have a bug or feature in mind, feel free to email Ian and find out how you can help.

The git repository for this project is maintained at https://github.com/sigmavirus24/rfc3986