def get_announcements(self):
"""
Funkcja pobieraj?ca dane ze strony https://librus.synergia.pl/ogloszenia
:returns: :return: lista [{"author": autor,
"title": tytu?,
"time": czas,
"content": zawarto??}]
"""
# Za?adowanie og?osze?
try:
data = loads(self.__opener.open('https://api.librus.pl/2.0/SchoolNotices').read())
except urllib2.HTTPError:
raise SessionExpiredError
print data
return [{'author': notice[u'AddedBy'][u'Id'],
'title': notice[u'Subject'].encode('utf-8'),
'content': notice[u'Content'].encode('utf-8'),
'time': notice[u'StartDate']
} for notice in data[u'SchoolNotices']]
评论列表
文章目录