File: wsgi_app.py

package info (click to toggle)
python-wsgi-intercept 0.8.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 288 kB
  • ctags: 201
  • sloc: python: 710; makefile: 180
file content (27 lines) | stat: -rw-r--r-- 616 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Simple WSGI applications for testing.
"""

from pprint import pformat

try:
    bytes
except ImportError:
    bytes = str


def simple_app(environ, start_response):
    """Simplest possible application object"""
    status = '200 OK'
    response_headers = [('Content-type', 'text/plain')]
    start_response(status, response_headers)
    return [b'WSGI intercept successful!\n']


def more_interesting_app(environ, start_response):
    start_response('200 OK', [('Content-type', 'text/plain')])
    return [pformat(environ).encode('utf-8')]


def raises_app(environ, start_response):
    raise TypeError("bah")