basic nodeinfo validation (location)
This commit is contained in:
parent
8b8b2cc324
commit
1835abac7f
2 changed files with 24 additions and 2 deletions
19
lib/validate.py
Normal file
19
lib/validate.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
import json
|
||||
|
||||
|
||||
def validate_nodeinfos(nodeinfos):
|
||||
result = []
|
||||
|
||||
for nodeinfo in nodeinfos:
|
||||
if validate_nodeinfo(nodeinfo):
|
||||
result.append(nodeinfo)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def validate_nodeinfo(nodeinfo):
|
||||
if 'location' in nodeinfo:
|
||||
if 'latitude' not in nodeinfo['location'] or 'longitude' not in nodeinfo['location']:
|
||||
return False
|
||||
|
||||
return True
|
Loading…
Add table
Add a link
Reference in a new issue