Tu Nombre commited on
Commit
f364107
·
1 Parent(s): e0d62e7

fix check space listo

Browse files
Files changed (1) hide show
  1. main.py +9 -0
main.py CHANGED
@@ -487,6 +487,15 @@ async def check_space(url: str = ""):
487
  pass
488
  return {"ready": False}
489
 
 
 
 
 
 
 
 
 
 
490
  @app.get("/esperando", response_class=HTMLResponse)
491
  async def esperando(url: str = "", email: str = ""):
492
  return f"""<!DOCTYPE html>
 
487
  pass
488
  return {"ready": False}
489
 
490
+ @app.get("/check-space")
491
+ async def check_space(url: str = ""):
492
+ try:
493
+ async with httpx.AsyncClient(timeout=5) as client:
494
+ r = await client.get(url)
495
+ return {"ready": r.status_code == 200}
496
+ except:
497
+ return {"ready": False}
498
+
499
  @app.get("/esperando", response_class=HTMLResponse)
500
  async def esperando(url: str = "", email: str = ""):
501
  return f"""<!DOCTYPE html>