When performing a GET requests for content from a web server, the web server will return a number of headers, one of which identities the type of the content from the perspective of the web server. In this recipe we learn to use that to determine what the web server considers the type of the content.
Determining the type of content for a URL
Getting ready
We again use the URLUtility class. The code for the recipe is in 04/03_determine_content_type_from_response.py.
How to do it
We proceed as follows:
- Execute the script for the recipe. It contains the following code...