Pure Python RFC 3986 Validator

0.1.1 · maintenance · verified Sat Mar 28

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

Install

Imports

Quickstart

The `validate_rfc3986` function checks if a given string conforms to the RFC 3986 URI syntax. It can also validate against specific rules like 'URI_reference'.

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

view raw JSON →