ofoqerp / quick_check.py
OfoqERP Deploy
fix: create tabRole table manually before seeding roles, add Guest enabled safety net
761ff32
Raw
History Blame Contribute Delete
1.39 kB
"""Quick check with short timeouts."""
import requests
from pathlib import Path
_env = Path(__file__).parent / ".env"
token = ""
if _env.exists():
for line in _env.read_text().splitlines():
line = line.strip()
if line.startswith("HF_TOKEN="):
token = line.split("=", 1)[1].strip()
break
# Check space URL with short timeout
print("=== Space URL ===")
try:
r = requests.get("https://hisham-cmd-ofoqerp.hf.space/api/method/frappe.utils.check", timeout=10)
print(f" Status: {r.status_code}")
print(f" Server: {r.headers.get('server', '?')}")
print(f" Body: {r.text[:200]}")
except requests.Timeout:
print(" TIMEOUT")
except Exception as e:
print(f" Error: {e}")
# Check runtime with short timeout
print("\n=== Runtime ===")
try:
r = requests.get(
"https://huggingface.co/api/spaces/hisham-cmd/ofoqerp/runtime",
headers={"Authorization": f"Bearer {token}"},
timeout=10
)
print(f" Status: {r.status_code}")
if r.ok:
d = r.json()
print(f" Stage: {d.get('stage', '?')}")
err = d.get("errorMessage", "")
if err:
lines = err.split("\\n")
for line in lines[-5:]:
print(f" {line.strip().rstrip(chr(34))}")
except requests.Timeout:
print(" TIMEOUT")
except Exception as e:
print(f" Error: {e}")