This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for scope in path_scopes: | |
filter_constraints = cgi.parse_qs(scope.params.get('params', '')) | |
filter_keys = set(request.args.keys()) & set(filter_constraints.keys()) | |
def arg_satisfies_filter(f): | |
return set(request.args[f]).issubset(set(filter_constraints[f])) | |
if all(arg_satisfies_filter(f) for f in filter_keys): | |
# if for every parameter, the values are a subset of allowed params, we good! | |
return True |