Skip to content

forced content type #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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