Skip to content

Commit 369a83c

Browse files
authored
Merge pull request #120 from FoamyGuy/force_content_type
forced content type
2 parents 8031c95 + 5928744 commit 369a83c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

adafruit_pyportal/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def set_caption(self, caption_text, caption_position, caption_color):
295295
)
296296
self.set_text(caption_text, index)
297297

298-
def fetch(self, refresh_url=None, timeout=10):
298+
def fetch(self, refresh_url=None, timeout=10, force_content_type=None):
299299
"""Fetch data from the url we initialized with, perfom any parsing,
300300
and display text or graphics. This function does pretty much everything
301301
Optionally update the URL
@@ -307,7 +307,10 @@ def fetch(self, refresh_url=None, timeout=10):
307307
response = self.network.fetch(self.url, headers=self._headers, timeout=timeout)
308308

309309
json_out = None
310-
content_type = self.network.check_response(response)
310+
if not force_content_type:
311+
content_type = self.network.check_response(response)
312+
else:
313+
content_type = force_content_type
311314
json_path = self._json_path
312315

313316
if content_type == CONTENT_JSON:

0 commit comments

Comments
 (0)