UniversalDevicesInc-PG3 / udi-poly-Airthings-Consumer

Polyglot V3 Node Server for Airthings Consumer API
0 stars 0 forks source link

Fatal error when printing error received #17

Closed jimboca closed 1 year ago

jimboca commented 1 year ago

This is trying to show 'message', where it should show 'error_description'

23-01-07 16:57:42,886 Thread-1585 udi_interface      DEBUG    pgSession:response:  Got: code=403
2023-01-07 16:57:42,887 Thread-1585 udi_interface      DEBUG    pgSession:response:       text={"error":"ACCESS_DENIED_DEVICE_DOES_NOT_BELONG_TO_USER","error_description":"device does not belong to user"}
2023-01-07 16:57:42,889 Thread-1585 udi_interface      ERROR    udi_interface:write: Exception in thread
2023-01-07 16:57:42,890 Thread-1585 udi_interface      ERROR    udi_interface:write: Thread-1585
2023-01-07 16:57:42,891 Thread-1585 udi_interface      ERROR    udi_interface:write: :
2023-01-07 16:57:42,892 Thread-1585 udi_interface      ERROR    udi_interface:write: Traceback (most recent call last):
2023-01-07 16:57:42,892 Thread-1585 udi_interface      ERROR    udi_interface:write: File "/usr/local/lib/python3.9/threading.py", line 980, in _bootstrap_inner
2023-01-07 16:57:42,896 Thread-1585 udi_interface      ERROR    udi_interface:write: self.run()
2023-01-07 16:57:42,897 Thread-1585 udi_interface      ERROR    udi_interface:write: File "/usr/local/lib/python3.9/threading.py", line 917, in run
2023-01-07 16:57:42,901 Thread-1585 udi_interface      ERROR    udi_interface:write: self._target(*self._args, **self._kwargs)
2023-01-07 16:57:42,901 Thread-1585 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/0021b90249d0_8/nodes/Controller.py", line 140, in handler_poll
2023-01-07 16:57:42,904 Thread-1585 udi_interface      ERROR    udi_interface:write: self.shortPoll()
2023-01-07 16:57:42,905 Thread-1585 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/0021b90249d0_8/nodes/Controller.py", line 144, in shortPoll
2023-01-07 16:57:42,906 Thread-1585 udi_interface      ERROR    udi_interface:write: self._query_all()
2023-01-07 16:57:42,907 Thread-1585 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/0021b90249d0_8/nodes/Controller.py", line 174, in _query_all
2023-01-07 16:57:42,909 Thread-1585 udi_interface      ERROR    udi_interface:write: node.shortPoll()
2023-01-07 16:57:42,909 Thread-1585 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/0021b90249d0_8/nodes/Sensor.py", line 103, in shortPoll
2023-01-07 16:57:42,911 Thread-1585 udi_interface      ERROR    udi_interface:write: self.query(force=False,authorize=False)
2023-01-07 16:57:42,912 Thread-1585 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/0021b90249d0_8/nodes/Sensor.py", line 113, in query
2023-01-07 16:57:42,914 Thread-1585 udi_interface      ERROR    udi_interface:write: st = self.controller.api_get(f"devices/{self.serial}/latest-samples")
2023-01-07 16:57:42,914 Thread-1585 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/0021b90249d0_8/nodes/Controller.py", line 198, in api_get
2023-01-07 16:57:42,916 Thread-1585 udi_interface      ERROR    udi_interface:write: res = self.session.get(
2023-01-07 16:57:42,917 Thread-1585 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/0021b90249d0_8/pgSession.py", line 65, in get
2023-01-07 16:57:42,919 Thread-1585 udi_interface      ERROR    udi_interface:write: return(self.response(response,'get'))
2023-01-07 16:57:42,920 Thread-1585 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/0021b90249d0_8/pgSession.py", line 88, in response
2023-01-07 16:57:42,921 Thread-1585 udi_interface      ERROR    udi_interface:write: self.logger.error("Forbidden: %s: text: %s" % (response.url,json_data['message']) )
2023-01-07 16:57:42,922 Thread-1585 udi_interface      ERROR    udi_interface:write: KeyError
2023-01-07 16:57:42,923 Thread-1585 udi_interface      ERROR    udi_interface:write: :
2023-01-07 16:57:42,923 Thread-1585 udi_interface      ERROR    udi_interface:write: 'message'