wsgigo


Namewsgigo JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/kkinder/wsgigo
SummaryWSGI application router
upload_time2024-07-03 11:15:17
maintainerNone
docs_urlNone
authorKen Kinder
requires_python<4.0,>=3.9
licenseMIT
keywords wsgi router middleware
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # WsgiGo

## What is it?

WSGI go is a very simple WSGI router with no requirements. It is written for Python 3, though it could be
easily backported.

## Installation

```
pip install wsgigo
```

## Usage

You can use it to route WSGI requests to specific apps based on hostname, URL fragment, or (through extending the
Route class) other criteria. For example, suppose you have three wsgi apps which you want to serve as one::

```python
from wsgigo import AppRouter

app = AppRouter(default_app=main_website)
app.add_startswith(docs_app, '/docs/')
app.add_hostname(api_app, 'api.local')
app.add_regexp(animal_app, '/(?:monkey|ape)/')
```

You can also make your own router class, to route apps how you need them to be routed::

```python
class InternetExplorerRouter(Route):
    def claim(self, environ):
        user_agent = environ['HTTP_USER_AGENT']
        if 'Trident/7.0' in user_agent or 'MSIE' in user_agent:
            return True

internet_explorer_app = TestWsgiApp("<b>really simple webpage</b>")
real_app = TestWsgiApp("<b>really ADVANCED webpage</b>")

router = AppRouter(default_app=real_app)
router.add_route(InternetExplorerRouter(internet_explorer_app))
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kkinder/wsgigo",
    "name": "wsgigo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "wsgi, router, middleware",
    "author": "Ken Kinder",
    "author_email": "ken+github@kkinder.com",
    "download_url": "https://files.pythonhosted.org/packages/09/0c/e85b78d88d9c6e70005c2792d3bf43aebd8613851da85aedb37092a2c808/wsgigo-1.3.0.tar.gz",
    "platform": null,
    "description": "# WsgiGo\n\n## What is it?\n\nWSGI go is a very simple WSGI router with no requirements. It is written for Python 3, though it could be\neasily backported.\n\n## Installation\n\n```\npip install wsgigo\n```\n\n## Usage\n\nYou can use it to route WSGI requests to specific apps based on hostname, URL fragment, or (through extending the\nRoute class) other criteria. For example, suppose you have three wsgi apps which you want to serve as one::\n\n```python\nfrom wsgigo import AppRouter\n\napp = AppRouter(default_app=main_website)\napp.add_startswith(docs_app, '/docs/')\napp.add_hostname(api_app, 'api.local')\napp.add_regexp(animal_app, '/(?:monkey|ape)/')\n```\n\nYou can also make your own router class, to route apps how you need them to be routed::\n\n```python\nclass InternetExplorerRouter(Route):\n    def claim(self, environ):\n        user_agent = environ['HTTP_USER_AGENT']\n        if 'Trident/7.0' in user_agent or 'MSIE' in user_agent:\n            return True\n\ninternet_explorer_app = TestWsgiApp(\"<b>really simple webpage</b>\")\nreal_app = TestWsgiApp(\"<b>really ADVANCED webpage</b>\")\n\nrouter = AppRouter(default_app=real_app)\nrouter.add_route(InternetExplorerRouter(internet_explorer_app))\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "WSGI application router",
    "version": "1.3.0",
    "project_urls": {
        "Homepage": "https://github.com/kkinder/wsgigo",
        "Repository": "https://github.com/kkinder/wsgigo"
    },
    "split_keywords": [
        "wsgi",
        " router",
        " middleware"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ef038c38301d4b4603a85d9ac42bdcf6f56a919e4f48854633c47819ea53831a",
                "md5": "070489dcc2c8177d5ce5406b29e4b2bd",
                "sha256": "679404b946a03116222afd2085b9b9fdfe5eddf6f2278cc64938da7dbe91e4be"
            },
            "downloads": -1,
            "filename": "wsgigo-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "070489dcc2c8177d5ce5406b29e4b2bd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 3343,
            "upload_time": "2024-07-03T11:15:16",
            "upload_time_iso_8601": "2024-07-03T11:15:16.281780Z",
            "url": "https://files.pythonhosted.org/packages/ef/03/8c38301d4b4603a85d9ac42bdcf6f56a919e4f48854633c47819ea53831a/wsgigo-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "090ce85b78d88d9c6e70005c2792d3bf43aebd8613851da85aedb37092a2c808",
                "md5": "02ce4b3f7136b5759c3cbf62fe7f148c",
                "sha256": "fa468a0683f6492289908da4ae3f0236041d08618cfc3b70d8a001945422ee9b"
            },
            "downloads": -1,
            "filename": "wsgigo-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "02ce4b3f7136b5759c3cbf62fe7f148c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 2898,
            "upload_time": "2024-07-03T11:15:17",
            "upload_time_iso_8601": "2024-07-03T11:15:17.887283Z",
            "url": "https://files.pythonhosted.org/packages/09/0c/e85b78d88d9c6e70005c2792d3bf43aebd8613851da85aedb37092a2c808/wsgigo-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-03 11:15:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kkinder",
    "github_project": "wsgigo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "wsgigo"
}
        
Elapsed time: 0.31333s