From ce0c040fcdb7c14b28509de4a97a0a4d878bdb30 Mon Sep 17 00:00:00 2001 From: Nicolas Hart Date: Sat, 23 Jul 2016 23:12:54 +0200 Subject: [PATCH] Allow use of access_token in github module --- i3pystatus/github.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/i3pystatus/github.py b/i3pystatus/github.py index 22a3f8c..d0fc61d 100644 --- a/i3pystatus/github.py +++ b/i3pystatus/github.py @@ -22,6 +22,7 @@ class Github(IntervalModule): color = '#78EAF2' username = '' password = '' + access_token = '' format = '{unread}' interval = 600 keyring_backend = None @@ -34,6 +35,7 @@ class Github(IntervalModule): ('unread_marker', 'sets the string that the "unread" formatter shows when there are pending notifications'), ("username", ""), ("password", ""), + ("access_token", ""), ("color", "") ) @@ -44,7 +46,10 @@ class Github(IntervalModule): def run(self): format_values = dict(unread_count='', unread='') - response = requests.get('https://api.github.com/notifications', auth=(self.username, self.password)) + if self.access_token: + response = requests.get('https://api.github.com/notifications?access_token=' + self.access_token) + else: + response = requests.get('https://api.github.com/notifications', auth=(self.username, self.password)) data = json.loads(response.text) # Bad credentials