zexrcvtyuboimpk
parent
5a6fdad6a0
commit
9344b13319
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue