Therefore, I am trying to convert a HEADER request for a content type to a file extension. A typical content type is similar to this for the html pages "text / html; charset = utf-8", which is a given response from python. I learned to use the mimetype module without any success, since it doesn't look like what I'm looking for.
Summary:
I want to convert "text / html; charset = utf-8" to this ".html"
A typical type of image content is "image / jpeg" depending on the type of image, but I'm not too worried about images, given that most URLs point the image in a path. This is more for sites that do not end in "blahahah.html"
I do not want to use libraries that are not in the python base library.
source share