From ecd0ec876a32ed4eb4b590079a4d8f5fe135dd63 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 5 Oct 2020 15:04:59 -0600 Subject: [PATCH 1/2] Fix issue with Requests 1.7.x --- adafruit_pyportal.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adafruit_pyportal.py b/adafruit_pyportal.py index 5c62b0a..8954952 100644 --- a/adafruit_pyportal.py +++ b/adafruit_pyportal.py @@ -885,13 +885,15 @@ def fetch(self, refresh_url=None, timeout=10): self.neo_status((0, 0, 100)) # green = got data print("Reply is OK!") - if self._debug: + if self._debug and not self._image_json_path or self._json_path: print(r.text) if self._image_json_path or self._json_path: try: gc.collect() json_out = r.json() + if self.debug: + print(json_out) gc.collect() except ValueError: # failed to parse? print("Couldn't parse json: ", r.text) From 8975f247b9045a190f74e57614d4b10e68307cf1 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 5 Oct 2020 15:08:15 -0600 Subject: [PATCH 2/2] Fix logic --- adafruit_pyportal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_pyportal.py b/adafruit_pyportal.py index 8954952..9e35ff9 100644 --- a/adafruit_pyportal.py +++ b/adafruit_pyportal.py @@ -885,14 +885,14 @@ def fetch(self, refresh_url=None, timeout=10): self.neo_status((0, 0, 100)) # green = got data print("Reply is OK!") - if self._debug and not self._image_json_path or self._json_path: + if self._debug and not self._image_json_path and not self._json_path: print(r.text) if self._image_json_path or self._json_path: try: gc.collect() json_out = r.json() - if self.debug: + if self._debug: print(json_out) gc.collect() except ValueError: # failed to parse?