From ac3791c0b8c5e41f72d428fe1ddc491563305a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Koch-Kramer?= Date: Mon, 4 Jul 2016 23:50:20 +0200 Subject: [PATCH] More serious error msg in case of nonexisting user --- instagram.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instagram.py b/instagram.py index b398329..6f1c9f9 100755 --- a/instagram.py +++ b/instagram.py @@ -188,8 +188,8 @@ def download(name, username = None, password = None, sessionfile = None, \ # and many branches. But we don't care. session = load_object(sessionfile) data = get_json(name, session=session) - if len(data["entry_data"]) == 0: - raise DownloaderException("user does not exist") + if len(data["entry_data"]) == 0 or "ProfilePage" not in data["entry_data"]: + raise DownloaderException("user %s does not exist" % name) else: download_profilepic(name, data["entry_data"]["ProfilePage"][0]["user"]["profile_pic_url"], quiet=quiet)