Skip to content

Speed up by not autoconnecting on setting URL #2

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 1 commit into from
Dec 7, 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
22 changes: 2 additions & 20 deletions adafruit_portalbase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def __init__(
json_transform=None,
debug=False,
):

self.network = network
self.graphics = graphics
self.splash = self.graphics.splash
Expand All @@ -82,9 +81,7 @@ def __init__(
self._alarm = alarm
except ImportError:
self._alarm = None

self._debug = debug
self._url = None
self.url = url
self._headers = headers
self._json_path = None
Expand Down Expand Up @@ -354,11 +351,11 @@ def fetch(self, refresh_url=None, timeout=10):

"""
if refresh_url:
self._url = refresh_url
self.url = refresh_url
values = []

values = self.network.fetch_data(
self._url,
self.url,
headers=self._headers,
json_path=self._json_path,
regexp_path=self._regexp_path,
Expand Down Expand Up @@ -426,21 +423,6 @@ def get_io_group(self, group_key):
"""
return self.network.get_io_group(group_key)

@property
def url(self):
"""
Get or set the URL of your data source.
"""
return self._url

@url.setter
def url(self, value):
self._url = value
if value and not self.network.uselocal:
self.network.connect()
# if self._debug:
# print("My IP address is", self.network.ip_address)

@property
def json_path(self):
"""
Expand Down