import urllib.request, json, urllib.error, http.cookiejar
cookie_jar = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookie_jar))
# Try the login endpoint
login_data = json.dumps({"password": "ASM-vps00#"}).encode()
req = urllib.request.Request("http://127.0.0.1:5100/api/auth/login", data=login_data, headers={"Content-Type": "application/json"}, method="POST")
try:
with opener.open(req, timeout=10) as r:
print("login:", r.status)
print(r.read().decode()[:500])
except urllib.error.HTTPError as e:
print("login error:", e.code, e.read().decode()[:500])
except Exception as e:
print("login error:", e)
# Check cookies
for cookie in cookie_jar:
print("Cookie:", cookie.name, "=", cookie.value[:50] if len(cookie.value) > 50 else cookie.value)
# Now try creating a cron job
payload = json.dumps({"prompt": "Test prompt", "schedule": "every 30m", "name": "Test Job", "deliver": ["local"]}).encode()
req = urllib.request.Request("http://127.0.0.1:5100/api/claude-jobs", data=payload, headers={"Content-Type": "application/json"}, method="POST")
try:
with opener.open(req, timeout=30) as r:
print("create job:", r.status)
print(r.read().decode())
except urllib.error.HTTPError as e:
print("create job error:", e.code, e.read().decode())
except Exception as e:
print("create job error:", e)