From cc186da748d4ffe4fa0909ddc7f758df3e7232e0 Mon Sep 17 00:00:00 2001 From: Francis CLAIRICIA-ROSE-CLAIRE-JOSEPHINE Date: Thu, 29 Feb 2024 09:44:27 +0100 Subject: [PATCH] README: Reduced asynchronous client example --- README.md | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 0df05780..454f884d 100644 --- a/README.md +++ b/README.md @@ -148,22 +148,6 @@ if __name__ == "__main__": Asynchronous version ( with async def ) ```py -import asyncio -from typing import Any, TypeAlias - -from easynetwork.clients import AsyncTCPNetworkClient -from easynetwork.protocol import StreamProtocol -from easynetwork.serializers import JSONSerializer - -RequestType: TypeAlias = Any -ResponseType: TypeAlias = Any - - -class JSONProtocol(StreamProtocol[RequestType, ResponseType]): - def __init__(self) -> None: - super().__init__(JSONSerializer()) - - async def main() -> None: async with AsyncTCPNetworkClient(("localhost", 9000), JSONProtocol()) as client: await client.send_packet({"data": {"my_body": ["as json"]}}) @@ -172,6 +156,8 @@ async def main() -> None: if __name__ == "__main__": + import asyncio + asyncio.run(main()) ```