updated list fetching
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-09-27 22:33:04 +02:00
parent 641398bde8
commit bb7571f518

View File

@@ -263,12 +263,15 @@ class Infomentor(object):
"""Builds a general infomentor (IM1) url""" """Builds a general infomentor (IM1) url"""
return self._build_url(path, base=self.BASE_IM1) return self._build_url(path, base=self.BASE_IM1)
def get_news_list(self): def _get_list(self, ep, sort="lastPublishDate___SORT_DESC"):
"""Fetches the list of news""" """Fetches the list of news"""
self.logger.info("fetching news") self.logger.info("fetching %s", ep)
self._do_post(self._mim_url("Communication/News/GetNewsList")) self._do_post(self._mim_url("Communication/{0}/Get{0}List".format(ep)), data={"pageSize":-1,"sortBy":"lastPublishDate___SORT_DESC"})
news_json = self.get_json_return() _json = self.get_json_return()
return news_json["items"] return _json["items"]
def get_news_list(self):
return self._get_list('News')
def get_news_article(self, news_entry): def get_news_article(self, news_entry):
"""Receive all the article information""" """Receive all the article information"""
@@ -311,6 +314,12 @@ class Infomentor(object):
url = "Communication/NewsImage/GetImage?id={}".format(id) url = "Communication/NewsImage/GetImage?id={}".format(id)
return self.download_file(url, directory="images", filename=filename) return self.download_file(url, directory="images", filename=filename)
def get_document_list(self):
return self._get_list('Documents')
def get_links_list(self):
return self._get_list('Links')
def get_calendar(self, offset=0, weeks=1): def get_calendar(self, offset=0, weeks=1):
"""Fetches a list of calendar entries""" """Fetches a list of calendar entries"""
self.logger.info("fetching calendar") self.logger.info("fetching calendar")