urlmatch


Nameurlmatch JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/jessepollak/urlmatch
SummaryPython library for matching URLs.
upload_time2017-06-02 17:36:25
maintainer
docs_urlNone
authorJesse Pollak
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            urlmatch - fnmatch for the web
==============================

Use ``urlmatch`` to verify that URLs conform to certain patterns. The
library and match patterns are based heavily on the `Google Chrome
Extension match
patterns <http://developer.chrome.com/extensions/match_patterns>`__.

Usage
-----

.. code:: python

    from urlmatch import urlmatch

    match_pattern = 'http://*.example.com/*'

    urlmatch(match_pattern, 'http://subdomain.example.com/') # True
    urlmatch(match_pattern, 'http://sub.subdomain.example.com/') # True

    urlmatch(match_pattern, 'https://example.com/') # False
    urlmatch(match_pattern, 'http://bad.com/') # False

Options
-------

There are a few options that affect how the match patterns work.

-  ``path_required`` (default is True) - a ``bool`` which dictates
   whether the match pattern must have path
-  ``fuzzy_scheme`` (default is False) - a ``bool`` which dictates
   whether the scheme should be matched "fuzzily." if this is true, then
   any valid scheme (``*``, ``http``, ``https``) will match both
   ``http`` and ``https``
-  ``http_auth_allowed`` (default is True) - ``bool`` which dictates
   whether URLs with HTTP Authentication in the URL should be allowed or
   not

Match pattern syntax
--------------------

The basic match pattern syntax is simple:

::

    <url-pattern> := <scheme>://<host><path>
    <scheme> := '*' | 'http' | 'https'
    <host> := '*' | '*.' <any char except '/' and '*'>+
    <path> := '/' <any chars>

Examples
~~~~~~~~

-  ``http://*/*`` - matches any URL that uses the http scheme
-  ``https://*/*`` - matches any URL that uses the https scheme
-  ``http://*/test*`` - matches any URL that uses the http scheme and
   has a path that starts with ``test``
-  ``*://test.com/*`` - matches any url with the domain ``test.com``
-  ``http://*.test.com`` - matches ``test.com`` and any subdomain of
   ``test.com``
-  ``http://test.com/foo/bar.html`` - matches the exact URL

Bugs
----

If you find an issue, let me know in the issues section!

Contributing
------------

From the `Rubinius <http://rubini.us/>`__ contribution page:

    Writing code and participating should be fun, not an exercise in
    perseverance. Stringent commit polices, for whatever their other
    qualities may bring, also mean longer turnaround times.

Submit a patch and once it's accepted, you'll get commit access to the
repository. Feel free to fork the repository and send a pull request,
once it's merged in you'll get added. If not, feel free to bug
`jessepollak <http://github.com/jessepollak>`__ about it.

How To Contribute
-----------------

-  Clone: ``git@github.com:jessepollak/urlmatch.git``
-  Create a topic branch: ``git checkout -b awesome_feature``
-  Commit away (and add unit tests for any code your write).
-  Keep up to date: ``git fetch && git rebase origin/master``.
-  Run the tests: ``python setup.py test``

Once you're ready:

-  Fork the project on GitHub
-  Add your repository as a remote:
   ``git remote add your_remote your_repo``
-  Push up your branch: ``git push your_remote awesome_feature``
-  Create a Pull Request for the topic branch, asking for review.

Once it's accepted:

-  If you want access to the core repository feel free to ask! Then you
   can change origin to point to the Read+Write URL:

::

    git remote set-url origin git@github.com:jessepollak/urlmatch.git

Otherwise, you can continue to hack away in your own fork.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jessepollak/urlmatch",
    "name": "urlmatch",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jesse Pollak",
    "author_email": "jpollak92@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/84/4e/654a4b6b335b339da7208ca1e54a34d1180e94c09b11b63dd76ee731b378/urlmatch-1.0.1.tar.gz",
    "platform": "",
    "description": "urlmatch - fnmatch for the web\n==============================\n\nUse ``urlmatch`` to verify that URLs conform to certain patterns. The\nlibrary and match patterns are based heavily on the `Google Chrome\nExtension match\npatterns <http://developer.chrome.com/extensions/match_patterns>`__.\n\nUsage\n-----\n\n.. code:: python\n\n    from urlmatch import urlmatch\n\n    match_pattern = 'http://*.example.com/*'\n\n    urlmatch(match_pattern, 'http://subdomain.example.com/') # True\n    urlmatch(match_pattern, 'http://sub.subdomain.example.com/') # True\n\n    urlmatch(match_pattern, 'https://example.com/') # False\n    urlmatch(match_pattern, 'http://bad.com/') # False\n\nOptions\n-------\n\nThere are a few options that affect how the match patterns work.\n\n-  ``path_required`` (default is True) - a ``bool`` which dictates\n   whether the match pattern must have path\n-  ``fuzzy_scheme`` (default is False) - a ``bool`` which dictates\n   whether the scheme should be matched \"fuzzily.\" if this is true, then\n   any valid scheme (``*``, ``http``, ``https``) will match both\n   ``http`` and ``https``\n-  ``http_auth_allowed`` (default is True) - ``bool`` which dictates\n   whether URLs with HTTP Authentication in the URL should be allowed or\n   not\n\nMatch pattern syntax\n--------------------\n\nThe basic match pattern syntax is simple:\n\n::\n\n    <url-pattern> := <scheme>://<host><path>\n    <scheme> := '*' | 'http' | 'https'\n    <host> := '*' | '*.' <any char except '/' and '*'>+\n    <path> := '/' <any chars>\n\nExamples\n~~~~~~~~\n\n-  ``http://*/*`` - matches any URL that uses the http scheme\n-  ``https://*/*`` - matches any URL that uses the https scheme\n-  ``http://*/test*`` - matches any URL that uses the http scheme and\n   has a path that starts with ``test``\n-  ``*://test.com/*`` - matches any url with the domain ``test.com``\n-  ``http://*.test.com`` - matches ``test.com`` and any subdomain of\n   ``test.com``\n-  ``http://test.com/foo/bar.html`` - matches the exact URL\n\nBugs\n----\n\nIf you find an issue, let me know in the issues section!\n\nContributing\n------------\n\nFrom the `Rubinius <http://rubini.us/>`__ contribution page:\n\n    Writing code and participating should be fun, not an exercise in\n    perseverance. Stringent commit polices, for whatever their other\n    qualities may bring, also mean longer turnaround times.\n\nSubmit a patch and once it's accepted, you'll get commit access to the\nrepository. Feel free to fork the repository and send a pull request,\nonce it's merged in you'll get added. If not, feel free to bug\n`jessepollak <http://github.com/jessepollak>`__ about it.\n\nHow To Contribute\n-----------------\n\n-  Clone: ``git@github.com:jessepollak/urlmatch.git``\n-  Create a topic branch: ``git checkout -b awesome_feature``\n-  Commit away (and add unit tests for any code your write).\n-  Keep up to date: ``git fetch && git rebase origin/master``.\n-  Run the tests: ``python setup.py test``\n\nOnce you're ready:\n\n-  Fork the project on GitHub\n-  Add your repository as a remote:\n   ``git remote add your_remote your_repo``\n-  Push up your branch: ``git push your_remote awesome_feature``\n-  Create a Pull Request for the topic branch, asking for review.\n\nOnce it's accepted:\n\n-  If you want access to the core repository feel free to ask! Then you\n   can change origin to point to the Read+Write URL:\n\n::\n\n    git remote set-url origin git@github.com:jessepollak/urlmatch.git\n\nOtherwise, you can continue to hack away in your own fork.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python library for matching URLs.",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/jessepollak/urlmatch"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "built for Darwin-16.5.0",
            "digests": {
                "blake2b_256": "7a1a56d2350573d36acd826c4a73300375e49b4d2f549bce406d314c19682f75",
                "md5": "8aed6b154f835ef73012dd7ca5e48041",
                "sha256": "21c88712cfaccf22270d2dd9957fccf9afb9fc6340fb34d169f93f6305ee8938"
            },
            "downloads": -1,
            "filename": "urlmatch-1.0.1.macosx-10.12-x86_64.tar.gz",
            "has_sig": false,
            "md5_digest": "8aed6b154f835ef73012dd7ca5e48041",
            "packagetype": "bdist_dumb",
            "python_version": "any",
            "requires_python": null,
            "size": 7897,
            "upload_time": "2017-06-02T17:36:28",
            "upload_time_iso_8601": "2017-06-02T17:36:28.422982Z",
            "url": "https://files.pythonhosted.org/packages/7a/1a/56d2350573d36acd826c4a73300375e49b4d2f549bce406d314c19682f75/urlmatch-1.0.1.macosx-10.12-x86_64.tar.gz",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "844e654a4b6b335b339da7208ca1e54a34d1180e94c09b11b63dd76ee731b378",
                "md5": "a7096f0de153721604ac9ba63e478ce5",
                "sha256": "3f0c3529f03f3b31efc4547ce44e6512ff5714bf61f7f6ac355b1636ad16eb2d"
            },
            "downloads": -1,
            "filename": "urlmatch-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a7096f0de153721604ac9ba63e478ce5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4995,
            "upload_time": "2017-06-02T17:36:25",
            "upload_time_iso_8601": "2017-06-02T17:36:25.117692Z",
            "url": "https://files.pythonhosted.org/packages/84/4e/654a4b6b335b339da7208ca1e54a34d1180e94c09b11b63dd76ee731b378/urlmatch-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2017-06-02 17:36:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jessepollak",
    "github_project": "urlmatch",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "urlmatch"
}
        
Elapsed time: 0.23572s