diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/fingerchange.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/fingerchange.py b/src/fingerchange.py index b34c009..952822f 100755 --- a/src/fingerchange.py +++ b/src/fingerchange.py @@ -23,7 +23,10 @@ def get_user_by_uid(site, uid): res = requests.get(api_url + str(uid), params=params) res = json.loads(res.text) - return res['items'][0] + if 'items' in res and len(res['items']) > 0: + return res['items'][0] + else: + return def get_users_by_name(site, name=''): @@ -35,7 +38,10 @@ def get_users_by_name(site, name=''): res = requests.get(api_url, params=params) res = json.loads(res.text) - return res['items'] + if 'items' in res: + return res['items'] + else: + return [] def format_url(url): |