Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Cleanup

Tomas Valenta63f3e7fc5159
diff --git a/.vscode/settings.json b/.vscode/settings.json
index f20e50a2f..6cb13409e 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -65,8 +65,7 @@
"python.defaultInterpreterPath": "./api-service/.venv/bin/python",
"python.analysis.extraPaths": [
"./**",
- "./api-service/.venv/bin/python",
- "./api-service/.venv"
+ "./api-service/.venv/bin/python"
],
// Disable Pylint and use just Pylance
"python.linting.enabled": false,
diff --git a/api-service/app.py b/api-service/app.py
index 2eb8dfefb..5eaac9d31 100644
--- a/api-service/app.py
+++ b/api-service/app.py
@@ -28,6 +28,7 @@ app = Quart(__name__)
app.config.from_prefixed_env()
app = cors(app, allow_origin="*")
+
def get_request_body_template(blocks: List[dict[str, str]]):
request_body_blocks = [
block for block in blocks if block.get("type") == "RequestBody"
@@ -37,22 +38,24 @@ def get_request_body_template(blocks: List[dict[str, str]]):
)
return request_body_template
+
@app.errorhandler(TimeoutError)
def timeout_handler(e):
return abort(408, e)
+
@app.errorhandler(Exception)
def exception_handler(e):
if isinstance(e, HTTPException):
return e
return abort(500, str(e))
+
@app.route("/health", methods=["GET"])
async def health():
return "OK"
-
# TODO: SECURITY - Check if user invoking this request has permission to generate and deploy to this project
@app.route("/generate", methods=["POST"])
async def generate():
@@ -103,7 +106,7 @@ async def generate():
blocks=blocks,
)
except Exception as e:
- print('Error while generating code:', e)
+ print("Error while generating code:", e)
raise e
deploy_url: str | None = None