wylark
/
infoex-autowx.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Catch KeyError exception when interpreting json
[infoex-autowx.git]
/
infoex-autowx.py
diff --git
a/infoex-autowx.py
b/infoex-autowx.py
index 15adf0832a24cd757fd5b989edc729020ee8eee8..9bd77c1f8315d1ad4528bd11859cad8eadeb3ae3 100755
(executable)
--- a/
infoex-autowx.py
+++ b/
infoex-autowx.py
@@
-41,7
+41,7
@@
import zeep
import zeep.cache
import zeep.transports
import zeep.cache
import zeep.transports
-__version__ = '3.
0.2
'
+__version__ = '3.
1.0
'
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.NOTSET)
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.NOTSET)
@@
-473,6
+473,9
@@
def get_mesowest_data(begin, end, station):
try:
observations = json['STATION'][0]['OBSERVATIONS']
try:
observations = json['STATION'][0]['OBSERVATIONS']
+ except KeyError:
+ LOG.error("Unexpected JSON in MesoWest response")
+ sys.exit(1)
except ValueError:
LOG.error("Bad JSON in MesoWest response")
sys.exit(1)
except ValueError:
LOG.error("Bad JSON in MesoWest response")
sys.exit(1)