From aa24871e53eafe56e4a3c636457368e2f3be92a2 Mon Sep 17 00:00:00 2001 From: Quentame Date: Fri, 20 Mar 2020 19:14:43 +0100 Subject: [PATCH] Fix Reminder KeyError: 'description' (#247) --- pyicloud/services/reminders.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/pyicloud/services/reminders.py b/pyicloud/services/reminders.py index 12e8ba2..94760ac 100644 --- a/pyicloud/services/reminders.py +++ b/pyicloud/services/reminders.py @@ -45,24 +45,21 @@ class RemindersService(object): if reminder['pGuid'] != collection['guid']: continue - if 'dueDate' in reminder: - if reminder['dueDate']: - due = datetime( - reminder['dueDate'][1], - reminder['dueDate'][2], reminder['dueDate'][3], - reminder['dueDate'][4], reminder['dueDate'][5] - ) - else: - due = None + + if reminder.get('dueDate'): + due = datetime( + reminder['dueDate'][1], + reminder['dueDate'][2], + reminder['dueDate'][3], + reminder['dueDate'][4], + reminder['dueDate'][5] + ) else: due = None - if reminder['description']: - desc = reminder['description'] - else: - desc = "" + temp.append({ "title": reminder['title'], - "desc": desc, + "desc": reminder.get('description'), "due": due }) self.lists[collection['title']] = temp