diff --git a/headphones/request.py b/headphones/request.py index a8b9e84d..6c8afda1 100644 --- a/headphones/request.py +++ b/headphones/request.py @@ -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: