Changeset 155:4b4c6d29886e
- Timestamp:
- 11/15/08 21:08:33 (3 years ago)
- Author:
- chris
- Branch:
- unix
- Message:
-
fix fetch simulation so that I can continue to work offline or without hammering the weather.gov site
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r154
|
r155
|
|
| 43 | 43 | |
| 44 | 44 | import urllib2 |
| | 45 | import urlparse |
| 45 | 46 | import logging |
| 46 | 47 | import sys |
| … |
… |
|
| 61 | 62 | try: |
| 62 | 63 | if(self.__simfetch): |
| 63 | | self.log.info("Simulating fetch using examples directory") |
| 64 | | dom = minidom.parse("examples/" + self.__url) |
| | 64 | urltuple = urlparse.urlparse(self.__url) |
| | 65 | file = "examples" + urltuple.path + "_" + urltuple.query |
| | 66 | self.log.info("Simulating fetch using examples directory: %s" % file) |
| | 67 | dom = minidom.parse(file) |
| 65 | 68 | else: |
| 66 | 69 | if(self.__proxy): |
-
|
r154
|
r155
|
|
| 46 | 46 | from WeatherTypes import * |
| 47 | 47 | from XmlFetcher import * |
| 48 | | from CAP import CAP |
| | 48 | from CapAtom import CapAtom |
| 49 | 49 | |
| 50 | 50 | class XmlWeather(object): |
| … |
… |
|
| 55 | 55 | self.__dom = [] |
| 56 | 56 | self.__baseurl = 'http://www.weather.gov/wwarss-tst/' |
| 57 | | #self.__url = self.__baseurl + self.__state.lower() + ".php?x=0" |
| 58 | | self.__url = "http://www.weather.gov/alerts/" + self.__state.lower() + ".cap" |
| 59 | | #self.__tag_item = 'cap:info' |
| | 57 | #self.__url = "http://www.weather.gov/alerts/" + self.__state.lower() + ".cap" |
| | 58 | self.__url = self.__baseurl + self.__state.lower() + ".php?x=0" |
| 60 | 59 | self.__tag_item = 'entry' |
| 61 | 60 | self.__history = history |
| … |
… |
|
| 86 | 85 | def __parse(self): |
| 87 | 86 | for capXmlText in self.__dom.getElementsByTagName(self.__tag_item): |
| 88 | | cap_item = CAP(capXmlText, self.__state) |
| 89 | | #cap_item.display() |
| | 87 | cap_item = CapAtom(capXmlText, self.__state) |
| | 88 | cap_item.display() |
| | 89 | sys.exit(0) |
| 90 | 90 | if(not self.__history.exists(cap_item.id)): |
| 91 | 91 | alerted = self.handleAlert(cap_item) |
-
|
r142
|
r155
|
|
| 51 | 51 | from StormSiren.History import History, DEFAULT_MAX_HISTORICAL_EVENTS |
| 52 | 52 | |
| 53 | | __RELEASE_VERSION = "2.0 RC3" |
| | 53 | __RELEASE_VERSION = "2.0 RC4" |
| 54 | 54 | __RELEASE_MONTH = "12" |
| 55 | 55 | __RELEASE_DAY = "08" |