URL matching library that relates URLs with resources. Rules are defined using simple pattern definitions. It is simpler and faster than using regular expressions if the rules involves many domains.
To illustrate it with an example, imagine that you have several proxy servers and you want to route requests to the right one. You could define the following rules:
site1.com →︎ us_proxy
site2.com/uk →︎ uk_proxy
site2.com/ie →︎ ie_proxy
All URLs from site1.com should use the US proxy. The situation for site2.com URLs are different: if the path starts with /uk, then use the UK proxy, otherwise use the IE proxy. This library allows to create a matcher that can be used to match URLs with the right proxy using these rules.
Have a look to https://github.com/zytedata/url-matcher/blob/main/url_matcher/example.py for an example of usage.
The following files are useful to understand the pattern, the set of patterns and how they behave:
https://github.com/zytedata/url-matcher/blob/main/tests/fixtures/single_patterns.json
https://github.com/zytedata/url-matcher/blob/main/tests/fixtures/patterns.json
The full documentation can be found at https://url-matcher.readthedocs.io/
License is BSD 3-clause.
Documentation: https://url-matcher.readthedocs.io/
Source code: https://github.com/zytedata/url-matcher
Issue tracker: https://github.com/zytedata/url-matcher/issues
Developing
Setup your local Python environment via:
pip install -r requirements-dev.txt
pre-commit install
Now everytime you perform a git commit, these tools will run against the staged files:
black
isort
flake8
mypy
You can also directly invoke pre-commit run --all-files to run them without performing a commit.
Using sphinx-autobuild
When working on documentation, it is convenient to use sphinx-autobuild. First, run pip install -r docs/requirements.txt sphinx-autobuild. Then run
sphinx-autobuild docs docs/_build/html
and then open http://127.0.0.1:8000/ in a browser, to see the current version of docs. A process would be running in a background, watching for docs changes; when docs are changed, a build is started, and the web page is refreshed automatically when the build is finished.
Metadata
Release files for url-matcher 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| url_matcher-0.6.0.tar.gz | 13.9 kB | Without provenance | Details for url_matcher-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| url_matcher-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for url_matcher-0.6.0-py3-none-any.whl |
Total release size: 25.5 kB
Release files / url_matcher-0.6.0.tar.gz
| Download URL | url_matcher-0.6.0.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5583392541e49fad0c64b287fca3af92de3eead7c004b35979b397d488f9e1b
|
|
BLAKE2b-256 checksum How to use checksums |
4f9c98ae4ed808841dfe1d6585a173ef2ff07435a4626ab98ea7d020962a5ebc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / url_matcher-0.6.0-py3-none-any.whl
| Download URL | url_matcher-0.6.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
103342c3bb337b2fa641dba36156e0fa58fee8a78ab1ad947f117f495d57c2da
|
|
BLAKE2b-256 checksum How to use checksums |
dd46033e16331bdbcbfcddb279f147ddca5e3b08e2268a8786efad00b451bf03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for url-matcher 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.