Exemplo n.º 1
0
    def _get_session(self):
        if not self._done.isSet():
            return False

        self._session_id = None
        self._done.clear()
        self._response = theta_api_v2.state()
        self._check_progress()

        while not self._done.isSet():
            self._done.wait(1)

        try:
            self._session_id = self._response['state']['sessionId']
        except KeyError:
            pass
        except TypeError:
            pass
        else:
            self._session_id = self._session_id.encode('ascii', 'ignore')

        if self._session_id is None or self._session_id == 'SID_0000':
            return self._start_session()
        else:
            return True
Exemplo n.º 2
0
 def _state(self):
     self._response = theta_api_v2.state()
     if self.callback is not None:
         self.callback(self._response)