[modules/github] quotes

This commit is contained in:
tobi-wan-kenobi 2020-04-18 17:00:17 +02:00
parent ed67f5515e
commit 2c4af853a5

View file

@ -28,9 +28,9 @@ class Module(bumblebee.engine.Module):
self.interval_factor(60) self.interval_factor(60)
self.interval(5) self.interval(5)
self._requests = requests.Session() self._requests = requests.Session()
self._requests.headers.update({"Authorization":"token {}".format(self.parameter("token", ""))}) self._requests.headers.update({'Authorization':'token {}'.format(self.parameter('token', ''))})
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
cmd="x-www-browser https://github.com/notifications") cmd='x-www-browser https://github.com/notifications')
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd=self.update) engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd=self.update)
def github(self, _): def github(self, _):
@ -39,7 +39,7 @@ class Module(bumblebee.engine.Module):
def update(self, _): def update(self, _):
try: try:
self._count = 0 self._count = 0
url = "https://api.github.com/notifications" url = 'https://api.github.com/notifications'
while True: while True:
notifications = self._requests.get(url) notifications = self._requests.get(url)
self._count += len(list(filter(lambda notification: notification['unread'], notifications.json()))) self._count += len(list(filter(lambda notification: notification['unread'], notifications.json())))
@ -50,7 +50,7 @@ class Module(bumblebee.engine.Module):
break break
except Exception: except Exception:
self._count = "n/a" self._count = 'n/a'
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4