class documentation

class URLPattern:

View In Hierarchy

A utility class currently used for making lookups against proxy keys...

# Wildcard matching... >>> pattern = URLPattern("all") >>> pattern.matches(httpx.URL("http://example.com")) True

# Witch scheme matching... >>> pattern = URLPattern("https") >>> pattern.matches(httpx.URL("https://example.com")) True >>> pattern.matches(httpx.URL("http://example.com")) False

# With domain matching... >>> pattern = URLPattern("https://example.com") >>> pattern.matches(httpx.URL("https://example.com")) True >>> pattern.matches(httpx.URL("http://example.com")) False >>> pattern.matches(httpx.URL("https://other.com")) False

# Wildcard scheme, with domain matching... >>> pattern = URLPattern("all://example.com") >>> pattern.matches(httpx.URL("https://example.com")) True >>> pattern.matches(httpx.URL("http://example.com")) True >>> pattern.matches(httpx.URL("https://other.com")) False

# With port matching... >>> pattern = URLPattern("https://example.com:1234") >>> pattern.matches(httpx.URL("https://example.com:1234")) True >>> pattern.matches(httpx.URL("https://example.com")) False

Method __eq__ Undocumented
Method __hash__ Undocumented
Method __init__ Undocumented
Method __lt__ Undocumented
Method matches Undocumented
Instance Variable host Undocumented
Instance Variable host​_regex Undocumented
Instance Variable pattern Undocumented
Instance Variable port Undocumented
Instance Variable scheme Undocumented
Property priority The priority allows URLPattern instances to be sortable, so that we can match from most specific to least specific.
def __eq__(self, other):

Undocumented

Parameters
other:typing.AnyUndocumented
Returns
boolUndocumented
def __hash__(self):

Undocumented

Returns
intUndocumented
def __init__(self, pattern):

Undocumented

Parameters
pattern:strUndocumented
def __lt__(self, other):

Undocumented

Parameters
other:URLPatternUndocumented
Returns
boolUndocumented
def matches(self, other):

Undocumented

Parameters
other:URLUndocumented
Returns
boolUndocumented
host =

Undocumented

host_regex: typing.Optional[typing.Pattern[str]] =

Undocumented

pattern =

Undocumented

port =

Undocumented

scheme =

Undocumented

@property
priority: tuple =
The priority allows URLPattern instances to be sortable, so that we can match from most specific to least specific.