feat: goctf final

This commit is contained in:
TakuyaYagam1 committed 2026-10-29 10:55:49 +03:00
commit f205b802d5
128 files changed
+37794

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import json
import os
import urllib.request
WAREHOUSE_URL = os.getenv("WAREHOUSE_URL", "http://warehouse:6000")
CALLBACK_TOKEN = os.environ["WAREHOUSE_CALLBACK_TOKEN"]
def submit_jobs(orders):
for order in orders:
try:
payload = json.dumps({"order_id": order["id"]}).encode()
request = urllib.request.Request(
f"{WAREHOUSE_URL}/jobs",
data=payload,
headers={"Content-Type": "application/json", "X-Warehouse-Token": CALLBACK_TOKEN},
method="POST",
)
with urllib.request.urlopen(request, timeout=.4):
pass
except (OSError, ValueError):
continue
def get_health():
with urllib.request.urlopen(f"{WAREHOUSE_URL}/health", timeout=.5) as response:
return json.loads(response.read())