diff options
| author | Ultrabug <ultrabug@gentoo.org> | 2015-03-11 18:49:31 +0100 |
|---|---|---|
| committer | Ultrabug <ultrabug@gentoo.org> | 2015-03-11 18:49:31 +0100 |
| commit | a7119803c420373903ac289eb44fc01b64a58ef7 (patch) | |
| tree | c6650d43801d436f2a65909ad8fecc5dd336f523 /py3status/modules/spaceapi.py | |
| parent | 6aefd207ecf8df4a8a594b47f9e27a7e0a26e3c4 (diff) | |
normalize module direct testing with a proper config
Diffstat (limited to 'py3status/modules/spaceapi.py')
| -rw-r--r-- | py3status/modules/spaceapi.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/py3status/modules/spaceapi.py b/py3status/modules/spaceapi.py index 8703fc9..c4fbf12 100644 --- a/py3status/modules/spaceapi.py +++ b/py3status/modules/spaceapi.py @@ -13,6 +13,7 @@ import json from time import time import urllib.request + class Py3status: """ Configuration Parameters: @@ -46,13 +47,13 @@ class Py3status: if not self.closed_color: self.closed_color = '' - # grab json file - json_file=urllib.request.urlopen(self.url) + # grab json file + json_file = urllib.request.urlopen(self.url) reader = codecs.getreader("utf-8") data = json.load(reader(json_file)) json_file.close() - - if(data['state']['open'] == True): + + if(data['state']['open'] is True): response['full_text'] = self.open_text response['short_text'] = '%H:%M' if self.open_color: @@ -69,7 +70,7 @@ class Py3status: response['short_text'] = dt.strftime(response['short_text']) except: - response['full_text'] = ''; + response['full_text'] = '' return response @@ -79,6 +80,10 @@ if __name__ == "__main__": """ from time import sleep x = Py3status() + config = { + 'color_good': '#00FF00', + 'color_bad': '#FF0000', + } while True: - print(x.check([], {'color_good': 'green'})) + print(x.check([], config)) sleep(1) |
