Skip to content

Add timeout override #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions adafruit_pyportal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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!")
Expand Down