diff --git a/pkgs/clan-cli/clan_cli/webui/routers/sql_connect.py b/pkgs/clan-cli/clan_cli/webui/routers/sql_connect.py index 35ed6ac..4ce85f0 100644 --- a/pkgs/clan-cli/clan_cli/webui/routers/sql_connect.py +++ b/pkgs/clan-cli/clan_cli/webui/routers/sql_connect.py @@ -1,7 +1,7 @@ import time from typing import List, Optional -from httpx import AsyncClient +import httpx from fastapi import APIRouter, BackgroundTasks, Depends from sqlalchemy.orm import Session @@ -209,10 +209,12 @@ async def attach_entity(entity_did: str, db: Session) -> None: try: while db_entity.attached: #query status endpoint - async with AsyncClient(app=app, base_url=f"http://{db_entity.ip}") as ac: - response = await ac.get("/") - # test with: while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; echo 'test'; } | nc -l 5556; done - #except not reached set false + # https://www.python-httpx.org/ + response = httpx.get(f"http://{db_entity.ip}", timeout=2) + print(response) + # test with: + # while true ; do printf 'HTTP/1.1 200 OK\r\n\r\ncool, thanks' | nc -l -N localhost 5555 ; done + # except not reached set false time.sleep(1) except Exception as e: raise e