Skip to content

Commit 4ffb7bf

Browse files
authored
Merge pull request #91 from makermelissa/master
Handle app/javascript as json. Fix missing text position error
2 parents 6511953 + 1dcd993 commit 4ffb7bf

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

adafruit_pyportal.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,9 @@ def __init__(
375375
self.set_caption(caption_text, caption_position, caption_color)
376376

377377
if text_font:
378-
if isinstance(text_position[0], (list, tuple)):
378+
if text_position is not None and isinstance(
379+
text_position[0], (list, tuple)
380+
):
379381
num = len(text_position)
380382
if not text_wrap:
381383
text_wrap = [0] * num
@@ -819,8 +821,8 @@ def _connect_esp(self):
819821
@staticmethod
820822
def image_converter_url(image_url, width, height, color_depth=16):
821823
"""Generate a converted image url from the url passed in,
822-
with the given width and height. aio_username and aio_key must be
823-
set in secrets."""
824+
with the given width and height. aio_username and aio_key must be
825+
set in secrets."""
824826
try:
825827
aio_username = secrets["aio_username"]
826828
aio_key = secrets["aio_key"]
@@ -933,6 +935,8 @@ def fetch(self, refresh_url=None, timeout=10):
933935
content_type = CONTENT_IMAGE
934936
elif "application/json" in headers["content-type"]:
935937
content_type = CONTENT_JSON
938+
elif "application/javascript" in headers["content-type"]:
939+
content_type = CONTENT_JSON
936940
else:
937941
print(
938942
"HTTP Error {}: {}".format(r.status_code, r.reason.decode("utf-8"))
@@ -1161,8 +1165,7 @@ def show_QR(
11611165
self._qr_only = hide_background
11621166

11631167
def hide_QR(self): # pylint: disable=invalid-name
1164-
"""Clear any QR codes that are currently on the screen
1165-
"""
1168+
"""Clear any QR codes that are currently on the screen"""
11661169

11671170
if self._qr_only:
11681171
board.DISPLAY.show(self.splash)

0 commit comments

Comments
 (0)