From 0264e4f7dd25fe7ba1bd2864141167ffe376acfd Mon Sep 17 00:00:00 2001 From: Moheeb Zara Date: Thu, 23 Apr 2020 14:18:23 -0700 Subject: [PATCH] Allow timeout override on fetch Small change to allow overriding of timeout in the get request under fetch. --- adafruit_pyportal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_pyportal.py b/adafruit_pyportal.py index 5d444bd..2fa9ae5 100644 --- a/adafruit_pyportal.py +++ b/adafruit_pyportal.py @@ -853,7 +853,7 @@ def push_to_io(self, feed_key, data): continue break - def fetch(self, refresh_url=None): + def fetch(self, refresh_url=None, timeout=10): """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 @@ -879,7 +879,7 @@ def fetch(self, refresh_url=None): print("Retrieving data...", end="") self.neo_status((100, 100, 0)) # yellow = fetching data gc.collect() - r = requests.get(self._url, headers=self._headers, timeout=10) + r = requests.get(self._url, headers=self._headers, timeout=timeout) gc.collect() self.neo_status((0, 0, 100)) # green = got data print("Reply is OK!")