From 89418d62b69bda1c51fc9dcc849d77cc0bae526d Mon Sep 17 00:00:00 2001 From: retoor Date: Wed, 27 Nov 2024 23:46:21 +0100 Subject: [PATCH] Progress --- dist/yura-14.3.7-py3-none-any.whl | Bin 2526 -> 3148 bytes dist/yura-14.3.7.tar.gz | Bin 2272 -> 2570 bytes setup.cfg | 4 ++++ src/yura.egg-info/SOURCES.txt | 2 ++ src/yura/client.py | 27 ++++++++++++++++++++------- 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/dist/yura-14.3.7-py3-none-any.whl b/dist/yura-14.3.7-py3-none-any.whl index f7018278265f1a724dfdd8d1109defb5deda4962..6cbbe8e9a7c624c52828c2fe9471d3b932b397e4 100644 GIT binary patch delta 1931 zcmZ`)2{hYl7XJ$(c_OW?MKQKo20dvamCjdBrdqbHVA>_v$WvaORO zf6Zyv;QHK3+UOo%>A!Q5dxa4%(F_Y9OKR1vGnE!Bn=@O^ulvRC$fPVc@crOgYu)kJ z%GSSFk(T(#6Xzy%h9U@4!J-ItJDA(dJWdw3!#3${8VdC~;U3~{-;Q??8RONDDHpHl ze-V{=+Xub=b#74jd8U^lq~iB8_BPx+BAjF)fFCUmO$raZY{U%!Z#ntHkCosb8qTRA z&voQxv8D)f+f61?*-|j1%Icn+|G4h^Q5!;qRhvuRVwcUIqQL>h@D{gsC84^d@%RNszW-85gr zvul2)Vu5$FoK0w~-|Oolt*TlI3MTL0+)~~5yxE>Wr&~8U^hwI!ExXRp-ufC*wfT`? z7qfrUz?{6p)v$2>7M*|tjx%dR*ILn1@?tDKx(iGQh6;ya4Zs+(nr z#OIlC#XJ62|BesB{$_0n_fAQJ*30}yYT*lAV5tz^kbM4fy4{jF(Bk87@F8oVFdxqJ8E~@;@eZ9t^3)weh z8)XilB-&KaY8J0M0ZuQ{3p_b2bwXI@+AR45c1D^oO|QyMU)A}9jf*M>uImizIlT>u zW2Ki_-FWbkEALs*leFwoR@r#eWJPAU&o`upIXdvNP1SQbqye^#FqnrBFfr&411qo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%>0z$TVa{qw!hg{T44%9W?7y66@qd8DOqZ6BM`5T`2 zk4_-AtvH+m-2-xqPy-hbd2PHue@Em&nHoMcC+-I;8xAa>kPr_>5NrB`&rZnAzI% z;Yn)dq8eg}6U!2lR=&5}14H(mij3@O6*TiZ8TU5T8LyjkvS5h4DZ-)HmimI-Jk%Cc zNT~%rn#A~JFz(9&h_2Ox6fm?mue<=5f_PZ&4+0ukMcGR{79Wnq0WSP2Jj#Lc%;a3n p-2V}#qbJCK2RU)TQ~5FA>CLklO-%UzgSUR6&^!G|e7Ssl{{{`W)w=)y diff --git a/setup.cfg b/setup.cfg index 2829c99..ac5d592 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,3 +18,7 @@ install_requires = [options.packages.find] where = src + +[options.entry_points] +console_scripts = + yura = yura.cli:run diff --git a/src/yura.egg-info/SOURCES.txt b/src/yura.egg-info/SOURCES.txt index 79c79b9..21a0719 100644 --- a/src/yura.egg-info/SOURCES.txt +++ b/src/yura.egg-info/SOURCES.txt @@ -3,9 +3,11 @@ pyproject.toml setup.cfg src/yura/__init__.py src/yura/__main__.py +src/yura/cli.py src/yura/client.py src/yura.egg-info/PKG-INFO src/yura.egg-info/SOURCES.txt src/yura.egg-info/dependency_links.txt +src/yura.egg-info/entry_points.txt src/yura.egg-info/requires.txt src/yura.egg-info/top_level.txt \ No newline at end of file diff --git a/src/yura/client.py b/src/yura/client.py index 5cea3d5..10ef5e0 100644 --- a/src/yura/client.py +++ b/src/yura/client.py @@ -14,10 +14,10 @@ class AsyncClient: self.queue_out = asyncio.Queue() self.communication_task = None - async def ensure_connection(): + async def ensure_connection(self): - if not self.ws: - self.ws = await websockets.connect(self.url) + # if not self.ws: + self.ws = await websockets.connect(self.url) return self.ws @@ -29,6 +29,23 @@ class AsyncClient: return self.communication_task async def chat(self, message): + + ws = await self.ensure_connection() + + await ws.send(json.dumps(message)) + + response = None + while True: + response_raw = await ws.recv() + response = json.loads(response_raw) + if not response["done"]: + yield response + else: + break + if response and response["done"]: + yield response + + async def chatw(self, message): await self.ensure_communication() await self.queue_out.put(message) while True: @@ -66,7 +83,6 @@ class AsyncClient: if response["done"]: break - await self.queue_in.put(response) await self.queue_in.put(response) @@ -87,9 +103,6 @@ async def cli_client(url="ws://127.0.0.1:8470"): print(response["content"], end="", flush=True) - if response["done"]: - break - print("")