예제 #1
0
 def load_alerts(self):
     '''
     NOTE: use refresh() instead of this, if you are just needing to refresh the alerts list
     Gets raw xml (cap) from the Alerts feed, throws it into the parser
     and ends up with a list of alerts object, which it stores to self._alerts
     '''
     self._feed = AlertsFeed(state=self.scope, maxage=self.cachetime)
     parser = CapParser(self._feed.raw_cap(), geo=self.geo)
     self._alerts = parser.get_alerts()
예제 #2
0
 def refresh(self, force=False):
     '''
     Refresh the alerts list. set `force` to True to force pulling a new list from the NWS, otherwise
     it'll only pull a new list if the cached copy is expired. (see cachetime)
     '''
     if force is True:
         self._feed.refresh()
     self._alerts = CapParser(self._feed.raw_cap(), geo=self.geo).get_alerts()
예제 #3
0
 def test_empty_feed(self):
     c = CapParser(empty_cap)
     c.get_alerts()
예제 #4
0
 def test_parser(self):
     c = CapParser(raw_cap=rc, geo=None)
     c.get_alerts()