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:

    For in this yellow grave of sand and sea
    A calling for colour calls with the wind
    That’s grave and gay as grave and sea
    Sleeping on either hand.
    Dylan Thomas (1914–1953)

    It is known that Whistler when asked how long it took him to paint one of his “nocturnes” answered: “All of my life.” With the same rigor he could have said that all of the centuries that preceded the moment when he painted were necessary. From that correct application of the law of causality it follows that the slightest event presupposes the inconceivable universe and, conversely, that the universe needs even the slightest of events.
    Jorge Luis Borges (1899–1986)