url-matcher


Nameurl-matcher JSON
Version 0.5.0 PyPI version JSON
download
home_pagehttps://github.com/zytedata/url-matcher
SummaryURL matching rules library to connect URLs with resources
upload_time2024-04-15 14:41:25
maintainerNone
docs_urlNone
authorZyte Group Ltd
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ===========
url-matcher
===========

.. image:: https://img.shields.io/pypi/v/url-matcher.svg
   :target: https://pypi.python.org/pypi/url-matcher
   :alt: PyPI Version

.. image:: https://img.shields.io/pypi/pyversions/url-matcher.svg
   :target: https://pypi.python.org/pypi/url-matcher
   :alt: Supported Python Versions

.. image:: https://github.com/zytedata/url-matcher/workflows/tox/badge.svg
   :target: https://github.com/zytedata/url-matcher/actions
   :alt: Build Status

.. image:: https://codecov.io/github/zytedata/url-matcher/coverage.svg?branch=main
   :target: https://codecov.io/gh/zytedata/url-matcher
   :alt: Coverage report


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:

1. ``pip install -r requirements-dev.txt``
2. ``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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zytedata/url-matcher",
    "name": "url-matcher",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Zyte Group Ltd",
    "author_email": "info@zyte.com",
    "download_url": "https://files.pythonhosted.org/packages/50/cb/c3fa38158e34a6e9d8034b3c084e6855ec1ed18672d8c6b9d1ce877c7090/url_matcher-0.5.0.tar.gz",
    "platform": null,
    "description": "===========\nurl-matcher\n===========\n\n.. image:: https://img.shields.io/pypi/v/url-matcher.svg\n   :target: https://pypi.python.org/pypi/url-matcher\n   :alt: PyPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/url-matcher.svg\n   :target: https://pypi.python.org/pypi/url-matcher\n   :alt: Supported Python Versions\n\n.. image:: https://github.com/zytedata/url-matcher/workflows/tox/badge.svg\n   :target: https://github.com/zytedata/url-matcher/actions\n   :alt: Build Status\n\n.. image:: https://codecov.io/github/zytedata/url-matcher/coverage.svg?branch=main\n   :target: https://codecov.io/gh/zytedata/url-matcher\n   :alt: Coverage report\n\n\nURL matching library that relates URLs with resources. Rules are defined using\nsimple pattern definitions. It is simpler and faster than using regular expressions\nif the rules involves many domains.\n\nTo illustrate it with an example, imagine that you have several proxy servers and\nyou want to route requests to the right one. You could define the following rules:\n\n* ``site1.com`` \u2192\ufe0e ``us_proxy``\n* ``site2.com/uk`` \u2192\ufe0e ``uk_proxy``\n* ``site2.com/ie`` \u2192\ufe0e ``ie_proxy``\n\nAll URLs from ``site1.com`` should use the US proxy. The situation for ``site2.com`` URLs are\ndifferent: if the path starts with ``/uk``, then use the UK proxy, otherwise use the IE proxy.\nThis library allows to create a matcher that can be used to match URLs with the right proxy\nusing these rules.\n\nHave a look to https://github.com/zytedata/url-matcher/blob/main/url_matcher/example.py\nfor an example of usage.\n\nThe following files are useful to understand the pattern, the set of patterns and\nhow they behave:\n\n* https://github.com/zytedata/url-matcher/blob/main/tests/fixtures/single_patterns.json\n* https://github.com/zytedata/url-matcher/blob/main/tests/fixtures/patterns.json\n\nThe full documentation can be found at https://url-matcher.readthedocs.io/\n\nLicense is BSD 3-clause.\n\n* Documentation: https://url-matcher.readthedocs.io/\n* Source code: https://github.com/zytedata/url-matcher\n* Issue tracker: https://github.com/zytedata/url-matcher/issues\n\n\nDeveloping\n**********\n\nSetup your local Python environment via:\n\n1. ``pip install -r requirements-dev.txt``\n2. ``pre-commit install``\n\nNow everytime you perform a ``git commit``, these tools will run against the staged files:\n\n* ``black``\n* ``isort``\n* ``flake8``\n* ``mypy``\n\nYou can also directly invoke ``pre-commit run --all-files`` to run them without performing a commit.\n\n\nUsing sphinx-autobuild\n~~~~~~~~~~~~~~~~~~~~~~\n\nWhen working on documentation, it is convenient to use sphinx-autobuild.\nFirst, run ``pip install -r docs/requirements.txt sphinx-autobuild``. Then run\n\n::\n\n    sphinx-autobuild docs docs/_build/html\n\nand then open http://127.0.0.1:8000/ in a browser, to see the current version\nof docs. A process would be running in a background, watching for docs changes;\nwhen docs are changed, a build is started, and the web page\nis refreshed automatically when the build is finished.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "URL matching rules library to connect URLs with resources",
    "version": "0.5.0",
    "project_urls": {
        "Homepage": "https://github.com/zytedata/url-matcher"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eca3d01e1743d0d6f3770ac53d65a7b6e338fec4bc652e37db318a4fa5f3b04e",
                "md5": "41025bb2fc0ce4c5895e000a81e6a778",
                "sha256": "cf76d66c258ea5b0d1fe1b5ee7c86045118b7beb1d843aecb7cb9642aefaff8e"
            },
            "downloads": -1,
            "filename": "url_matcher-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "41025bb2fc0ce4c5895e000a81e6a778",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11269,
            "upload_time": "2024-04-15T14:41:23",
            "upload_time_iso_8601": "2024-04-15T14:41:23.888454Z",
            "url": "https://files.pythonhosted.org/packages/ec/a3/d01e1743d0d6f3770ac53d65a7b6e338fec4bc652e37db318a4fa5f3b04e/url_matcher-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "50cbc3fa38158e34a6e9d8034b3c084e6855ec1ed18672d8c6b9d1ce877c7090",
                "md5": "ecf61ed3fb6babee779e008d6b97bd8a",
                "sha256": "a8e2914003f99051ad2cdf25b129027502cea752e2415c71e3d2dac846870094"
            },
            "downloads": -1,
            "filename": "url_matcher-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ecf61ed3fb6babee779e008d6b97bd8a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 12891,
            "upload_time": "2024-04-15T14:41:25",
            "upload_time_iso_8601": "2024-04-15T14:41:25.452163Z",
            "url": "https://files.pythonhosted.org/packages/50/cb/c3fa38158e34a6e9d8034b3c084e6855ec1ed18672d8c6b9d1ce877c7090/url_matcher-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-15 14:41:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zytedata",
    "github_project": "url-matcher",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "url-matcher"
}
        
Elapsed time: 0.22055s