How to use the somecomfort.client.AuthError function in somecomfort

To help you get started, we’ve selected a few somecomfort examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kk7ds / somecomfort / somecomfort / client.py View on Github external
def _login(self):
        self._session.get(self._baseurl, timeout=self._timeout)
        params = {'UserName': self._username,
                  'Password': self._password,
                  'RememberMe': 'false',
                  'timeOffset': 480}
        resp = self._session.post(self._baseurl, params=params,
                                  timeout=self._timeout)
        if resp.status_code != 200:
            # This never seems to happen currently, but
            # I'll leave it here in case they start doing the
            # right thing.
            _LOG.error('Login as %s failed', self._username)
            raise AuthError('Login failed')

        self._default_url = resp.url

        # Try a keepalive to see if we're _really_ logged in
        try:
            self.keepalive()
        except SessionTimedOut:
            _LOG.error('Login as %s failed', self._username)
            raise AuthError('Login failed')
github kk7ds / somecomfort / somecomfort / client.py View on Github external
timeout=self._timeout)
        if resp.status_code != 200:
            # This never seems to happen currently, but
            # I'll leave it here in case they start doing the
            # right thing.
            _LOG.error('Login as %s failed', self._username)
            raise AuthError('Login failed')

        self._default_url = resp.url

        # Try a keepalive to see if we're _really_ logged in
        try:
            self.keepalive()
        except SessionTimedOut:
            _LOG.error('Login as %s failed', self._username)
            raise AuthError('Login failed')