From be7fa79e8abf67b1ea0cb7b5004088eea5a90e8d Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Thu, 6 Jul 2017 13:47:32 +0200 Subject: [PATCH] [modules/github] Move the requests.get inside the try/except --- bumblebee/modules/github.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bumblebee/modules/github.py b/bumblebee/modules/github.py index 7a64594..2b82a07 100644 --- a/bumblebee/modules/github.py +++ b/bumblebee/modules/github.py @@ -39,12 +39,12 @@ class Module(bumblebee.engine.Module): token = self.parameter("token", "") if not token: - self._count = 0 + self._count = "n/a" return - notifications = requests.get("https://api.github.com/notifications", headers={"Authorization":"token {}".format(token)}).text - unread = 0 try: + notifications = requests.get("https://api.github.com/notifications", headers={"Authorization":"token {}".format(token)}).text + unread = 0 for notification in json.loads(notifications): if "unread" in notification and notification["unread"]: unread += 1