[modules/github] Move the requests.get inside the try/except
This commit is contained in:
parent
494b11be88
commit
be7fa79e8a
1 changed files with 3 additions and 3 deletions
|
@ -39,12 +39,12 @@ class Module(bumblebee.engine.Module):
|
||||||
token = self.parameter("token", "")
|
token = self.parameter("token", "")
|
||||||
|
|
||||||
if not token:
|
if not token:
|
||||||
self._count = 0
|
self._count = "n/a"
|
||||||
return
|
return
|
||||||
|
|
||||||
notifications = requests.get("https://api.github.com/notifications", headers={"Authorization":"token {}".format(token)}).text
|
|
||||||
unread = 0
|
|
||||||
try:
|
try:
|
||||||
|
notifications = requests.get("https://api.github.com/notifications", headers={"Authorization":"token {}".format(token)}).text
|
||||||
|
unread = 0
|
||||||
for notification in json.loads(notifications):
|
for notification in json.loads(notifications):
|
||||||
if "unread" in notification and notification["unread"]:
|
if "unread" in notification and notification["unread"]:
|
||||||
unread += 1
|
unread += 1
|
||||||
|
|
Loading…
Reference in a new issue