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:

    ‘No, go I must, they’re calling
    me.’
    ‘Who are they?’
    Rising he said “Some
    day you’ll know. They’re calling to you
    too.’ Darkly he rose, and then I slept.
    Frank O’Hara (1926–1966)

    If you would be a favourite of your king, address yourself to his weaknesses. An application to his reason will seldom prove very successful.
    Philip Dormer Stanhope, 4th Earl Chesterfield (1694–1773)