from mimetypes import MimeTypes
import urllib.request, urllib.parse, urllib.error
mime = MimeTypes()
url = urllib.request.pathname2url('Upload.xml')
mime_type = mime.guess_type(url)
print(mime_type)
get mimetype of file python