-
Notifications
You must be signed in to change notification settings - Fork 0
/
valid.py
39 lines (26 loc) · 1.02 KB
/
valid.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
import json
import copy
def getValidParameter(resource):
validParameterTemplate = open('valid_parameter.json', 'r')
validParameterJson = json.load(validParameterTemplate)
validParameter = validParameterJson.get(resource, '')
return validParameter
def getRestrictionParameter():
restrictionParameterTemplate = open('restriction_parameter.json', 'r')
restrictionParameterJson = json.load(restrictionParameterTemplate)
restrictionParameter = restrictionParameterJson.get('restrictionParameter', '')
return restrictionParameter
def validateParameter(data, validParamter, restrictionParameter):
newData = {}
newDict = {}
for key, value in data.items():
for parameter in validParamter:
if parameter in key:
newDict[key] = value
newData = copy.deepcopy(newDict)
for key, value in newDict.items():
for parameter in restrictionParameter:
if parameter in key:
del newData[key]
return newData