code: def _thread_listen(self):
          
          while self._running:
              try:
                  rest = requests.get(URL_LISTEN.format(self._url),
                                      timeout=self._timeout)
                  if rest.status_code == 200:
                      self._queue.put(rest.json())
                  else:
                      _LOGGER.error('QSUSB response code %s', rest.status_code)
                      sleep(30)
  
              # Received for "Read timed out" and "Connection refused"
              except requests.exceptions.ConnectionError as err:
                  if str(err).find('timed') > 0:  # "Read timedout" update
                      self._queue.put({QS_CMD: CMD_UPDATE})
                  else:  # "Connection refused" QSUSB down
                      _LOGGER.error(str(err))
                      sleep(60)
              except Exception as err:  # pylint: disable=broad-except
                  _LOGGER.error("%s - %s", str(type(err)), str(err))
                  sleep(5)
  
          self._queue.put({})
docs: The main &listen loop.