From 89c830789d56e5064da2b5168db31df50f3caa72 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 12 Jul 2017 16:06:17 +0200 Subject: [PATCH] [modules/github] Use GITHUB_TOKEN environment variable if present --- bumblebee/modules/github.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bumblebee/modules/github.py b/bumblebee/modules/github.py index 6c97650..018f5ac 100644 --- a/bumblebee/modules/github.py +++ b/bumblebee/modules/github.py @@ -7,9 +7,11 @@ Requires the following library: Parameters: * github.token: GitHub user access token, the token needs to have the 'notifications' scope. + The value of the token can also be set using a 'GITHUB_TOKEN' environment variable. * github.interval: Interval in minutes """ +import os import time import functools import bumblebee.input @@ -41,7 +43,7 @@ class Module(bumblebee.engine.Module): def update(self, _, immediate=False): if immediate or self._nextcheck < int(time.time()): self._nextcheck = int(time.time()) + self._interval * 60 - token = self.parameter("token", "") + token = self.parameter("token", os.environ.get("GITHUB_TOKEN")) if not token: self._count = "n/a"