zexrcvtyuboimpk

master
daz 2013-11-24 16:51:06 +01:00
parent 5a6fdad6a0
commit 9344b13319
1 changed files with 8 additions and 8 deletions

View File

@ -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:
json_dict = json.loads(api_content)
users = json_dict["users"]
unknown = json_dict["unknown"]
@ -56,9 +53,12 @@ class HelloPython(plasmascript.Applet):
self, INTERVAL*6000, Plasma.AlignToMinute)
def update_list(self):
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):