Web Server Gateway Interface - Example of Calling An Application

Example of Calling An Application

An example of calling an application and retrieving its response:

def call_application(app, environ): body = status_headers = def start_response(status, headers): status_headers = return body.append app_iter = app(environ, start_response) try: for item in app_iter: body.append(item) finally: if hasattr(app_iter, 'close'): app_iter.close return status_headers, status_headers, ''.join(body) status, headers, body = call_application(app, {...environ...})

Read more about this topic:  Web Server Gateway Interface

Famous quotes containing the words calling and/or application:

    Calling a taxi in Texas is like calling a rabbi in Iraq.
    Fran Lebowitz (b. 1950)

    The receipt to make a speaker, and an applauded one too, is short and easy.—Take of common sense quantum sufficit, add a little application to the rules and orders of the House, throw obvious thoughts in a new light, and make up the whole with a large quantity of purity, correctness, and elegancy of style.
    Philip Dormer Stanhope, 4th Earl Chesterfield (1694–1773)