MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / validate_view

Function validate_view

botasaurus_server/botasaurus_server/validation.py:128–143  ·  view source on GitHub ↗
(json_data, allowed_views)

Source from the content-addressed store, hash-verified

126 return filters
127
128def validate_view(json_data, allowed_views):
129 view = json_data.get("view")
130
131 if view:
132 if not is_string_of_min_length(view):
133 raise JsonHTTPResponseWithMessage(
134 "View must be a string with at least one character"
135 )
136
137 view = view.lower()
138 if view not in allowed_views:
139 raise JsonHTTPResponseWithMessage(
140 f"Invalid view. Must be one of: {', '.join(allowed_views)}."
141 )
142
143 return view
144
145def validate_sort(json_data, allowed_sorts, default_sort):
146 sort = json_data.get("sort", default_sort)

Callers 2

validate_results_requestFunction · 0.85
validate_download_paramsFunction · 0.85

Calls 4

is_string_of_min_lengthFunction · 0.85
joinMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected