class URLPattern:
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. |