zebpalmer / WeatherAlerts

Python script to parse the National Weather Service 'Cap' Alerts Feed and do interesting things with it.
MIT License
31 stars 14 forks source link

fix NWS samecode url #7

Closed csabatini closed 9 years ago

csabatini commented 9 years ago

I was getting started with this project and noticed that the unit tests for geo.py and weatheralerts.py were failing.

======================================================================
ERROR: test_samecode_lookup_false (__main__.Test_GeoDB)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_geodb.py", line 9, in setUp
    self.geo = GeoDB()
  File "weatheralerts\geo.py", line
16, in __init__
    self.__same = SameCodes()
  File "weatheralerts\geo.py", line
93, in __init__
    self._load_same_codes()
  File "weatheralerts\geo.py", line
109, in _load_same_codes
    self._cached_same_codes()
  File "weatheralerts\geo.py", line
149, in _cached_same_codes
    self.reload()
  File "weatheralerts\geo.py", line
102, in reload
    self._load_same_codes(refresh=True)
  File "weatheralerts\geo.py", line
107, in _load_same_codes
    self._get_same_codes()
  File "weatheralerts\geo.py", line
119, in _get_same_codes
    code, local, state = str(row).strip().split(',')
ValueError: need more than 1 value to unpack

----------------------------------------------------------------------
Ran 8 tests in 0.512s

FAILED (errors=8)

It seems the HTTP call made in _get_same_codes() is to a dead url, found the new location here: http://www.nws.noaa.gov/nwr/data/SameCode.txt. All tests passing again after this update.

zebpalmer commented 9 years ago

thanks