def login(self, email, password): """ Attempts to create an authenticated session using the email and password provided. Return True if the login was successful, False otherwise. Raises AlreadyLoggedIn if the session is already authenticated. :param email: The email address of the account to log in. :param password: The password of the account to log in. """ if self.logged_in: raise AlreadyLoggedIn self.client = ClientLogin(email, password, 'sj') tokenauth = TokenAuth('sj', self.PLAY_URL, 'jumper') if self.client.get_auth_token() is None: return False tokenauth.authenticate(self.client) self.cookies = tokenauth.get_cookies() self.logged_in = self._get_cookies() return self.logged_in
def login(self, email, password): """ Attempts to create an authenticated session using the email and password provided. Return ``True`` if the login was successful, ``False`` otherwise. Raises AlreadyLoggedIn if the session is already authenticated. :param email: The email address of the account to log in. :param password: The password of the account to log in. """ if self.logged_in: raise AlreadyLoggedIn self.client = ClientLogin(email, password, 'sj') tokenauth = TokenAuth('sj', self.PLAY_URL, 'jumper') if self.client.get_auth_token() is None: return False tokenauth.authenticate(self.client) self.web_cookies = tokenauth.get_cookies() if self._get_cookies(): self.logged_in = True else: self.logged_in = False return self.logged_in