Allow use of access_token in github module
This commit is contained in:
parent
5dbfc2110a
commit
ce0c040fcd
@ -22,6 +22,7 @@ class Github(IntervalModule):
|
|||||||
color = '#78EAF2'
|
color = '#78EAF2'
|
||||||
username = ''
|
username = ''
|
||||||
password = ''
|
password = ''
|
||||||
|
access_token = ''
|
||||||
format = '{unread}'
|
format = '{unread}'
|
||||||
interval = 600
|
interval = 600
|
||||||
keyring_backend = None
|
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'),
|
('unread_marker', 'sets the string that the "unread" formatter shows when there are pending notifications'),
|
||||||
("username", ""),
|
("username", ""),
|
||||||
("password", ""),
|
("password", ""),
|
||||||
|
("access_token", ""),
|
||||||
("color", "")
|
("color", "")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -44,7 +46,10 @@ class Github(IntervalModule):
|
|||||||
def run(self):
|
def run(self):
|
||||||
format_values = dict(unread_count='', unread='')
|
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)
|
data = json.loads(response.text)
|
||||||
|
|
||||||
# Bad credentials
|
# Bad credentials
|
||||||
|
Loading…
Reference in New Issue
Block a user