Skip to content

Commit 1961f99

Browse files
author
Moheeb Zara
authored
Merge pull request #1 from virgilvox/virgilvox-patch-1
Allow timeout override on fetch
2 parents fbeab7f + 0264e4f commit 1961f99

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_pyportal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ def push_to_io(self, feed_key, data):
853853
continue
854854
break
855855

856-
def fetch(self, refresh_url=None):
856+
def fetch(self, refresh_url=None, timeout=10):
857857
"""Fetch data from the url we initialized with, perfom any parsing,
858858
and display text or graphics. This function does pretty much everything
859859
Optionally update the URL
@@ -879,7 +879,7 @@ def fetch(self, refresh_url=None):
879879
print("Retrieving data...", end="")
880880
self.neo_status((100, 100, 0)) # yellow = fetching data
881881
gc.collect()
882-
r = requests.get(self._url, headers=self._headers, timeout=10)
882+
r = requests.get(self._url, headers=self._headers, timeout=timeout)
883883
gc.collect()
884884
self.neo_status((0, 0, 100)) # green = got data
885885
print("Reply is OK!")

0 commit comments

Comments
 (0)