diff --git a/spond/spond.py b/spond/spond.py index b95f3a9..c4465a1 100644 --- a/spond/spond.py +++ b/spond/spond.py @@ -31,7 +31,10 @@ async def login(self): data = {"email": self.username, "password": self.password} async with self.clientsession.post(login_url, json=data) as r: login_result = await r.json() - self.token = login_result["loginToken"] + self.token = login_result.get("loginToken", None) + if self.token is None: + err_msg = f"Login failed. Response received: {login_result}" + raise ValueError(err_msg) api_chat_url = f"{self.api_url}chat" headers = {