Merge pull request #122 from fredj/github_network_down

github module: move the requests.get inside the try/except
This commit is contained in:
tobi-wan-kenobi 2017-07-06 19:42:13 +02:00 committed by GitHub
commit 8fb100c237

View file

@ -39,12 +39,12 @@ class Module(bumblebee.engine.Module):
token = self.parameter("token", "")
if not token:
self._count = 0
self._count = "n/a"
return
try:
notifications = requests.get("https://api.github.com/notifications", headers={"Authorization":"token {}".format(token)}).text
unread = 0
try:
for notification in json.loads(notifications):
if "unread" in notification and notification["unread"]:
unread += 1