Skip to content

Commit 2fc1142

Browse files
committed
Added URL option to fetch
1 parent d8fb889 commit 2fc1142

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

adafruit_pyportal.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
https://github.com/adafruit/circuitpython/releases
4242
4343
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
44+
"""
45+
"""
46+
04/19/2019
47+
John Turner
48+
Added ability to call the fetch object with a URL fetch(URL) this allows the URL to be updated once pyportal is initialized
49+
4450
"""
4551

4652
import os
@@ -646,9 +652,13 @@ def image_converter_url(image_url, width, height, color_depth=16):
646652
width, height,
647653
color_depth, image_url)
648654

649-
def fetch(self):
655+
def fetch(self, refresh_url=None):
650656
"""Fetch data from the url we initialized with, perfom any parsing,
651-
and display text or graphics. This function does pretty much everything"""
657+
and display text or graphics. This function does pretty much everything
658+
Optionally update the URL
659+
"""
660+
if refresh_url:
661+
self._url = refresh_url
652662
json_out = None
653663
image_url = None
654664
values = []

0 commit comments

Comments
 (0)