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:

    These are the voices of the pastors calling
    And calling like the long echoes in long sleep,
    Generations of shepherds to generations of sheep.
    Wallace Stevens (1879–1955)

    May my application so close
    To so endless a repetition
    Not make me tired and morose
    And resentful of man’s condition.
    Robert Frost (1874–1963)