Pure Python RFC 3986 Validator
rfc3986-validator is a pure Python library designed for validating Uniform Resource Identifiers (URIs) according to RFC 3986. It offers a single validation function. The library is currently at version 0.1.1, released in October 2019, and is designated as '2 - Pre-Alpha' development status, indicating a very inactive release cadence and experimental nature.
Warnings
- gotcha This library is classified as '2 - Pre-Alpha' and has not seen updates since October 2019. Its long-term maintenance and compatibility with newer Python versions (beyond 3.8) are uncertain.
- gotcha The `rfc3986-validator` library provides a single `validate_rfc3986` function for basic URI validation. It does not offer granular control over URI components (like scheme, host, path, query) or methods for constructing URIs.
Install
-
pip install rfc3986-validator
Imports
- validate_rfc3986
from rfc3986_validator import validate_rfc3986
Quickstart
from rfc3986_validator import validate_rfc3986
# Validate a full URI
print(validate_rfc3986('http://example.com/path?query=val#fragment')) # Expected: True
# Validate a URI reference (e.g., relative path)
print(validate_rfc3986('//example.com/path', rule='URI_reference')) # Expected: True
# Example of an invalid URI
print(validate_rfc3986('http://foo.bar?q=Spaces should be encoded')) # Expected: False