From d40180cd428171c4c86c303673c9bf76a34eeeaa Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Mon, 24 Apr 2017 19:05:17 -0700 Subject: [PATCH] handle lack of displayname --- appservice.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appservice.py b/appservice.py index 66d2e5f..c6b0459 100644 --- a/appservice.py +++ b/appservice.py @@ -142,6 +142,6 @@ def get_displayname(userid): r = requests.get(url) if r.status_code == 200: data = json.loads(r.text) - return data["displayname"] - else: - return userid \ No newline at end of file + if 'displayname' in data: + return data["displayname"] + return userid