From 9344b13319ce59c477954ffad1ddd3d7cd9b6cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dzikie=20dro=C5=BCd=C5=BCe?= Date: Sun, 24 Nov 2013 16:51:06 +0100 Subject: [PATCH] zexrcvtyuboimpk --- hs-applet/contents/code/main.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hs-applet/contents/code/main.py b/hs-applet/contents/code/main.py index 6081fc7..108cfcc 100644 --- a/hs-applet/contents/code/main.py +++ b/hs-applet/contents/code/main.py @@ -41,10 +41,7 @@ class HelloPython(plasmascript.Applet): self.resize(125, 125) def get_user_list(self): - try: - api_content = urlopen("https://at.hackerspace.pl/api").read() - except (URLError, HTTPError): - pass # TODO: + api_content = urlopen("https://at.hackerspace.pl/api").read() json_dict = json.loads(api_content) users = json_dict["users"] unknown = json_dict["unknown"] @@ -53,12 +50,15 @@ class HelloPython(plasmascript.Applet): def connect_to_engine(self): self.timeEngine = self.dataEngine("time") self.timeEngine.connectSource("Local", - self, INTERVAL*6000, Plasma.AlignToMinute) + self, INTERVAL*6000, Plasma.AlignToMinute) def update_list(self): - users, unknown = self.get_user_list() - users = "\n".join(users) - self.at_list.setText(LABEL_TEMPLATE.format(users=users, unknown=unknown)) + try: + users, unknown = self.get_user_list() + users = "\n".join(users) + self.at_list.setText(LABEL_TEMPLATE.format(users=users, unknown=unknown)) + except (URLError, HTTPError): + self.at_list.setText("hakerspejs umar") @pyqtSignature("dataUpdated(const QString &, const Plasma::DataEngine::Data &)") def dataUpdated(self, sourceName, data):