mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-17 00:07:37 +02:00
check for key in dictionary
This commit is contained in:
@ -331,7 +331,7 @@ def process(proc_data):
|
|||||||
int_list = ['hop', 'asn']
|
int_list = ['hop', 'asn']
|
||||||
float_list = ['rtt']
|
float_list = ['rtt']
|
||||||
|
|
||||||
if proc_data['hops']:
|
if 'hops' in proc_data:
|
||||||
for entry in proc_data['hops']:
|
for entry in proc_data['hops']:
|
||||||
for key in int_list:
|
for key in int_list:
|
||||||
if key in entry:
|
if key in entry:
|
||||||
@ -347,7 +347,7 @@ def process(proc_data):
|
|||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
entry[key] = None
|
entry[key] = None
|
||||||
|
|
||||||
if entry['probes']:
|
if 'probes' in entry:
|
||||||
for item in entry['probes']:
|
for item in entry['probes']:
|
||||||
for key in int_list:
|
for key in int_list:
|
||||||
if key in item:
|
if key in item:
|
||||||
|
Reference in New Issue
Block a user