-
-
Save chadselph/1057572 to your computer and use it in GitHub Desktop.
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment