Skip to content

Instantly share code, notes, and snippets.

View chadselph's full-sized avatar

Chad Selph chadselph

View GitHub Profile
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