diff --git a/adafruit_portalbase/network.py b/adafruit_portalbase/network.py index 6665de8..43ed1f8 100755 --- a/adafruit_portalbase/network.py +++ b/adafruit_portalbase/network.py @@ -435,6 +435,7 @@ def fetch_data( json_path=None, regexp_path=None, timeout=10, + json_content_type=None, ): """Fetch data from the specified url and perfom any parsing @@ -444,7 +445,7 @@ def fetch_data( :param regexp_path: The path formatted as a regular expression to drill down into the JSON data. :param int timeout: The timeout period in seconds. - + :param json_content_type: A known value for content-type when JSON is returned """ json_out = None values = [] @@ -468,6 +469,8 @@ def fetch_data( content_type = CONTENT_JSON elif "application/javascript" in headers["content-type"]: content_type = CONTENT_JSON + elif json_content_type and json_content_type in headers["content-type"]: + content_type = CONTENT_JSON else: if self._debug: if "content-length" in headers: