Skip to content

Commit a789a1a

Browse files
authored
Merge pull request #27 from brentru/add-image-http-path
Adding an URL-based image path kwarg to PyPortal
2 parents d8fb889 + b36f0b0 commit a789a1a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

adafruit_pyportal.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ class PyPortal:
141141
:param caption_position: The position of your caption on the display as an (x, y) tuple.
142142
Defaults to ``None``.
143143
:param caption_color: The color of your caption. Must be a hex value, e.g. ``0x808000``.
144+
:param image_url_path: The HTTP traversal path for a background image to display.
145+
Defaults to ``None``.
144146
:param debug: Turn on debug print outs. Defaults to False.
145147
146148
"""
@@ -151,7 +153,7 @@ def __init__(self, *, url=None, headers=None, json_path=None, regexp_path=None,
151153
text_wrap=False, text_maxlen=0, text_transform=None,
152154
image_json_path=None, image_resize=None, image_position=None,
153155
caption_text=None, caption_font=None, caption_position=None,
154-
caption_color=0x808080,
156+
caption_color=0x808080, image_url_path=None,
155157
success_callback=None, debug=False):
156158

157159
self._debug = debug
@@ -317,9 +319,10 @@ def __init__(self, *, url=None, headers=None, json_path=None, regexp_path=None,
317319
self._text = None
318320

319321
self._image_json_path = image_json_path
322+
self._image_url_path = image_url_path
320323
self._image_resize = image_resize
321324
self._image_position = image_position
322-
if image_json_path:
325+
if image_json_path or image_url_path:
323326
if self._debug:
324327
print("Init image path")
325328
if not self._image_position:
@@ -690,6 +693,9 @@ def fetch(self):
690693
if self._regexp_path:
691694
import re
692695

696+
if self._image_url_path:
697+
image_url = self._image_url_path
698+
693699
# extract desired text/values from json
694700
if self._json_path:
695701
for path in self._json_path:

0 commit comments

Comments
 (0)