csm10495 / pyhtcc

Unofficial Python API for TCC Thermostats
16 stars 7 forks source link

need to catch requests.exceptions.JSONDecodeError within _request_json #12

Closed cjkrolak closed 1 year ago

cjkrolak commented 1 year ago

I think the fix from #10 is catching the wrong JSONDecodeError, I'm seeing requests.exceptions.JSONDecodeError being raised, code is catching json.JSONDecodeError:

  File "/home/pi/github/ThermostatSupervisor/thermostatsupervisor/honeywell.py", line 660, in refresh_zone_info
    all_zones_info = self.pyhtcc.get_zones_info()
  File "/home/pi/.local/lib/python3.9/site-packages/pyhtcc/pyhtcc.py", line 707, in get_zones_info
    more_data = self._get_check_data_session(device_id)
  File "/home/pi/.local/lib/python3.9/site-packages/pyhtcc/pyhtcc.py", line 632, in _get_check_data_session
    return self._request_json(
  File "/home/pi/.local/lib/python3.9/site-packages/pyhtcc/pyhtcc.py", line 656, in _request_json
    result_json = result.json()
  File "/home/pi/.local/lib/python3.9/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
csm10495 commented 1 year ago

Doh. Fixed in 0.1.51. Thanks!