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:

    Gone are the days when my heart was young and gay,
    Gone are my friends from the cotton fields away,
    Gone from the earth to a better land I know,
    I hear their gentle voices calling “Old Black Joe.”
    Stephen Collins Foster (1826–1864)

    The application requisite to the duties of the office I hold [governor of Virginia] is so excessive, and the execution of them after all so imperfect, that I have determined to retire from it at the close of the present campaign.
    Thomas Jefferson (1743–1826)