Skip to main content

Simple wsgi app that routes requests to other wsgi apps. A WSGI router.

Project description

What is it?

WSGI go is a very simple WSGI router with no requirements. It does currently require 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:

from wsgigo import AppRouter

app = AppRouter(default_app=main_website)
app.add_startswith(docs_app, '/docs/')
app.add_hostname(api_app, 'api.local')

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

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))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wsgigo-1.0.1.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file wsgigo-1.0.1.tar.gz.

File metadata

  • Download URL: wsgigo-1.0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for wsgigo-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3f4edbbaeb730f6a92d38206c47c761db3a177f730663be9533c1a5262eed376
MD5 20a2656e28313b9c94ff006411fa9693
BLAKE2b-256 4e79e20e5f88f7ecae4fa61286a5ef4a5fd2e268997fc86b260f3ce2e52e9ca6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page