1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-10-03 22:07:11 +02:00

Fix KeyError on login attempt with wrong password

This commit is contained in:
André Koch-Kramer 2018-03-18 17:41:03 +01:00
parent b2f31e7782
commit f55334cd5b

View File

@ -947,7 +947,7 @@ class Instaloader:
def test_login(self) -> Optional[str]:
"""Returns the Instagram username to which given :class:`requests.Session` object belongs, or None."""
data = self.graphql_query("d6f4427fbe92d846298cf93df0b937d3", {})
return data["data"]["user"]["username"] if "username" in data["data"]["user"] else None
return data["data"]["user"]["username"] if data["data"]["user"] is not None else None
def login(self, user: str, passwd: str) -> None:
"""Log in to instagram with given username and password and internally store session object"""