Fighting with mailcap

This commit is contained in:
Michael Lazar
2016-07-08 23:51:42 -07:00
parent 06ac572b20
commit 1d8c555c27
5 changed files with 60 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import re
import mimetypes
from html.parser import HTMLParser
from six.moves.html_parser import HTMLParser
import requests
@@ -116,7 +116,8 @@ class ImgurHandler(BaseHandler):
def get_mimetype(url):
imgur_page = requests.get(url)
try:
ImgurHTMLParser().feed(imgur_page.text)
# convert_charrefs will be true by default in python 3.5
ImgurHTMLParser(convert_charrefs=True).feed(imgur_page.text)
except HTMLParsed as data:
# We found a link
url = data.data