in http/get_indirect/python/server/server.py [0:0]
def list_directory(self, path):
host, port = self.server.server_address
try:
file_paths = [
f for f in os.listdir(path)
if f.endswith(".arrows") and os.path.isfile(os.path.join(path, f))
]
except OSError:
self.send_error(404, "No permission to list directory")
return None
file_uris = [f"http://{host}:{port}{self.path}{f}" for f in file_paths]
uris_doc = {"arrow_stream_files": [{"uri": f} for f in file_uris]}
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(json.dumps(uris_doc, indent=4).encode("utf-8"))
return None