INNER CODE UNIT · Python
repl
iamgreggarcia/codesherpa · localserver/main.py:175
def repl(request: CodeExecutionRequest):
"""
Execute code.
Note: This endpoint current supports a REPL-like environment for Python only.
Args:
request (CodeExecutionRequest): The request object containing the code to execute.
Returns:
CodeExecutionResponse: The result of the code execution.
"""
logger.info(f"Received request for REPL execution: {request}")
executor = executors.get(request.language)
if executor is None:
return {"error": "Language not supported"}
try: