diff --git a/adafruit_httpserver/response.py b/adafruit_httpserver/response.py index 4329a8f..8c6d240 100644 --- a/adafruit_httpserver/response.py +++ b/adafruit_httpserver/response.py @@ -17,9 +17,19 @@ import os import json from binascii import b2a_base64 -import hashlib from errno import EAGAIN, ECONNRESET, ETIMEDOUT, ENOTCONN +try: + try: + import hashlib + except ImportError: + import adafruit_hashlib as hashlib +except ImportError: + print( + "WARNING: hashlib module not available and adafruit_hashlib not installed.", + "Websocket support will not work.", + ) + from .exceptions import ( BackslashInPathError, FileNotExistsError,