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:

    “I introduced her to Elena, and in that life-quickening atmosphere of a big railway station where everything is something trembling on the brink of something else, thus to be clutched and cherished, the exchange of a few words was enough to enable two totally dissimilar women to start calling each other by their pet names the very next time they met.”
    —Vladimir Nabokov (1899–1977)

    “The best political economy is the care and culture of men; for, in these crises, all are ruined except such as are proper individuals, capable of thought, and of new choice and the application of their talent to new labor.”
    —Ralph Waldo Emerson (1803–1882)