Fix for #2183. Check to make sure the response has headers before trying to parse them

This commit is contained in:
rembo10
2015-07-03 21:01:46 -07:00
parent 624a1d5509
commit 3e81c4f3b6

View File

@@ -206,7 +206,7 @@ def server_message(response):
message = None
# First attempt is to 'read' the response as HTML
if "text/html" in response.headers.get("content-type"):
if response.headers and "text/html" in response.headers.get("content-type"):
try:
soup = BeautifulSoup(response.content, "html5lib")
except Exception: