It is good practice to use the content-type header to determine the type of content, and to determine the extension to use for storing the content as a file.
Determining the file extension from a content type
Getting ready
We again use the URLUtility object that we created. The recipe's script is 04/04_determine_file_extension_from_contenttype.py):.
How to do it
Proceed by running the recipe's script.
An extension for the media type can be found using the .extension property:
util = URLUtility(const.ApodEclipseImage())
print("Filename from content-type: ...