wip
This commit is contained in:
parent
892a3c9a8a
commit
3f28a10b16
5 changed files with 98 additions and 111 deletions
12
client.py
12
client.py
|
|
@ -3,12 +3,15 @@ import time
|
|||
from rich.console import Console
|
||||
from websocket import create_connection
|
||||
|
||||
from learn_sql_model.models.hero import Hero
|
||||
from learn_sql_model.config import get_config
|
||||
from learn_sql_model.models.hero import Heros
|
||||
|
||||
config = get_config()
|
||||
|
||||
|
||||
def connect():
|
||||
id = 1
|
||||
url = f"ws://localhost:5000/ws/{id}"
|
||||
url = f"ws://{config.api_client.url.replace('https://', '')}/ws/heros"
|
||||
# url = f"ws://localhost:5000/ws/heros"
|
||||
Console().log(f"connecting to: {url}")
|
||||
ws = create_connection(url)
|
||||
Console().log(f"connected to: {url}")
|
||||
|
|
@ -23,7 +26,8 @@ def watch(ws):
|
|||
try:
|
||||
data.append(ws.recv())
|
||||
if data[-1].startswith("{"):
|
||||
Console().log(Hero.parse_raw(data[-1]))
|
||||
# Console().log(data[-1])
|
||||
Console().log(Heros.parse_raw(data[-1]))
|
||||
else:
|
||||
Console().log(data[-1])
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue