Skip to content

An open-source, faster Devin alternative

TypeScript

fix(deploy): identify builder API clients

Igor Zalutski6af0324df5a5
diff --git a/ci/flue-builder-substrate-probe.py b/ci/flue-builder-substrate-probe.py
index c9a983aa..86cbe5cb 100755
--- a/ci/flue-builder-substrate-probe.py
+++ b/ci/flue-builder-substrate-probe.py
@@ -200,7 +200,11 @@ class LiveProbe:
quoted_path = parse.quote(path, safe="")
req = request.Request(
f"{self.api_url}/sandboxes/{quoted_id}/files?path={quoted_path}",
- headers={"Accept": "application/octet-stream", "X-API-Key": self.api_key},
+ headers={
+ "Accept": "application/octet-stream",
+ "User-Agent": SNAPSHOT.USER_AGENT,
+ "X-API-Key": self.api_key,
+ },
)
try:
with self.api.opener.open(req, timeout=30) as response:
diff --git a/deploy/flue-builder/snapshot.py b/deploy/flue-builder/snapshot.py
index 4f01d253..70ee5898 100755
--- a/deploy/flue-builder/snapshot.py
+++ b/deploy/flue-builder/snapshot.py
@@ -20,6 +20,7 @@ from urllib import error, parse, request
ROOT = Path(__file__).resolve().parent
COORDINATE_PATH = ROOT / "coordinate.json"
PRODUCTION_HOSTS = {"app.opencomputer.dev", "api.opencomputer.dev"}
+USER_AGENT = "OpenComputer-Flue-Builder/1.0"
class SnapshotError(RuntimeError):
@@ -169,7 +170,11 @@ class API:
) -> tuple[int, Any]:
allowed = allowed_statuses or {200}
payload = None if body is None else canonical_json(body)
- headers = {"Accept": "application/json", "X-API-Key": self.api_key}
+ headers = {
+ "Accept": "application/json",
+ "User-Agent": USER_AGENT,
+ "X-API-Key": self.api_key,
+ }
if payload is not None:
headers["Content-Type"] = "application/json"
req = request.Request(