Пример #1
0
    def _check_auth(self):
        if not self.username or not self.passkey:
            raise AuthException(
                'Your authentication credentials for {0} are missing,'
                ' check your config.'.format(self.name))

        return True
Пример #2
0
    def _check_auth(self):
        if self.username and self.password:
            return True

        raise AuthException(
            'Your authentication credentials for {0} are missing,'
            ' check your config.'.format(self.name))
Пример #3
0
    def _check_auth(self):
        if not self.passkey:
            raise AuthException(
                'Your authentication credentials are missing, check your config.'
            )

        return True
Пример #4
0
    def _check_auth(self):

        if not self.username or not self.passkey:
            raise AuthException(('Your authentication credentials for %s are '
                                 'missing, check your config.') % self.name)

        return True
Пример #5
0
    def login(self):
        """Login method used for logging in before doing search and torrent downloads."""
        login_params = {
            'pid': self.pid,
            'username': self.username,
            'password': self.password
        }

        response = self.session.post(self.urls['login'], data=login_params)
        try:
            jdata = response.json()
            if 'message' in jdata:
                raise AuthException(f"Error trying to auth, {jdata['message']}")
        except (AttributeError, ValueError):
            log.debug('No data returned from provider')
            raise AuthException('Could not get auth token')

        if 'token' in jdata:
            self._token = jdata['token']
            return True

        return False