Skip to content

Commit

Permalink
Merge pull request #120 from FoamyGuy/force_content_type
Browse files Browse the repository at this point in the history
forced content type
  • Loading branch information
makermelissa authored Jan 18, 2022
2 parents 8031c95 + 5928744 commit 369a83c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions adafruit_pyportal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def set_caption(self, caption_text, caption_position, caption_color):
)
self.set_text(caption_text, index)

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

json_out = None
content_type = self.network.check_response(response)
if not force_content_type:
content_type = self.network.check_response(response)
else:
content_type = force_content_type
json_path = self._json_path

if content_type == CONTENT_JSON:
Expand Down

0 comments on commit 369a83c

Please sign in to comment.