Learning Python Networking - Second Edition
by José Manuel Ortega, Dr. M. O. Faruque Sarker, Sam Washington
Creating a WSGI application
All the requests that we make to our server will be handled by the WSGI application, which will be a single file. This application will be responsible for handling the requests and returning the appropriate response according to the requested URL. In this application, we will have to define a function that acts with each user's request. This function must be a valid application WSGI function. This means that it should be called application and it should receive two parameters: environ, from the os module, which provides a dictionary of standard HTTP requests and other environment variables, and the start_response function, from WSGI, which is responsible for delivering the HTTP response to the user.
In the following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access