MCPcopy Create free account
hub / github.com/OWASP/Python-Honeypot / get_static_files

Function get_static_files

api/server.py:234–256  ·  view source on GitHub ↗

getting static files and return content mime types Args: path: path and filename Returns: file content and content type if file found otherwise abort(404)

(path)

Source from the content-addressed store, hash-verified

232@app.route("/", defaults={"path": ""})
233@app.route("/<path:path>")
234def get_static_files(path):
235 """
236 getting static files and return content mime types
237
238 Args:
239 path: path and filename
240
241 Returns:
242 file content and content type if file found otherwise abort(404)
243 """
244 static_types = all_mime_types()
245 return Response(
246 get_file(
247 os.path.join(
248 root_dir(),
249 path
250 )
251 ),
252 mimetype=static_types.get(
253 os.path.splitext(path)[1],
254 "text/html"
255 )
256 )
257
258
259@app.route("/api/events/count/<event_type>", methods=["GET"])

Callers

nothing calls this directly

Calls 3

all_mime_typesFunction · 0.90
root_dirFunction · 0.90
get_fileFunction · 0.85

Tested by

no test coverage detected