%global _empty_manifest_terminate_build 0 Name: python-signalr-async Version: 3.0.0 Release: 1 Summary: Python SignalR async client License: MIT URL: https://github.com/sam-mosleh/signalr-async Source0: https://mirrors.nju.edu.cn/pypi/web/packages/26/96/b89c5725e5902a399af078b35a28e86b55d851ebb266d41f21e1ca654727/signalr-async-3.0.0.tar.gz BuildArch: noarch Requires: python3-aiohttp Requires: python3-msgpack %description # SignalR-Async
SignalR-Async is a python client for ASP.NET & ASP.NET Core SignalR, ready for building bidirectional communication. ## Installation ```bash pip install signalr-async ``` ## Example ### Create it - Create a file `main.py` with: ```Python import asyncio from signalr_async.netcore import Hub, Client from signalr_async.netcore.protocols import MessagePackProtocol class MyHub(Hub): async def on_connect(self, connection_id: str) -> None: """Will be awaited after connection established""" async def on_disconnect(self) -> None: """Will be awaited after client disconnection""" def on_event_one(self, x: bool, y: str) -> None: """Invoked by server synchronously on (event_one)""" async def on_event_two(self, x: bool, y: str) -> None: """Invoked by server asynchronously on (event_two)""" async def get_something(self) -> bool: """Invoke (method) on server""" return await self.invoke("method", "arg1", 2) hub = MyHub("my-hub") @hub.on("event_three") async def three(z: int) -> None: pass @hub.on async def event_four(z: int) -> None: pass async def multi_event(z: int) -> None: pass for i in range(10): hub.on(f"event_{i}", multi_event) async def main(): token = "mytoken" headers = {"Authorization": f"Bearer {token}"} async with Client( "https://localhost:9000", hub, connection_options={ "http_client_options": {"headers": headers}, "ws_client_options": {"headers": headers, "timeout": 1.0}, "protocol": MessagePackProtocol(), }, ) as client: return await hub.get_something() asyncio.run(main()) ``` ## Resources See the [SignalR Documentation](https://docs.microsoft.com/aspnet/core/signalr) at docs.microsoft.com for documentation on the latest release. %package -n python3-signalr-async Summary: Python SignalR async client Provides: python-signalr-async BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-signalr-async # SignalR-Async SignalR-Async is a python client for ASP.NET & ASP.NET Core SignalR, ready for building bidirectional communication. ## Installation ```bash pip install signalr-async ``` ## Example ### Create it - Create a file `main.py` with: ```Python import asyncio from signalr_async.netcore import Hub, Client from signalr_async.netcore.protocols import MessagePackProtocol class MyHub(Hub): async def on_connect(self, connection_id: str) -> None: """Will be awaited after connection established""" async def on_disconnect(self) -> None: """Will be awaited after client disconnection""" def on_event_one(self, x: bool, y: str) -> None: """Invoked by server synchronously on (event_one)""" async def on_event_two(self, x: bool, y: str) -> None: """Invoked by server asynchronously on (event_two)""" async def get_something(self) -> bool: """Invoke (method) on server""" return await self.invoke("method", "arg1", 2) hub = MyHub("my-hub") @hub.on("event_three") async def three(z: int) -> None: pass @hub.on async def event_four(z: int) -> None: pass async def multi_event(z: int) -> None: pass for i in range(10): hub.on(f"event_{i}", multi_event) async def main(): token = "mytoken" headers = {"Authorization": f"Bearer {token}"} async with Client( "https://localhost:9000", hub, connection_options={ "http_client_options": {"headers": headers}, "ws_client_options": {"headers": headers, "timeout": 1.0}, "protocol": MessagePackProtocol(), }, ) as client: return await hub.get_something() asyncio.run(main()) ``` ## Resources See the [SignalR Documentation](https://docs.microsoft.com/aspnet/core/signalr) at docs.microsoft.com for documentation on the latest release. %package help Summary: Development documents and examples for signalr-async Provides: python3-signalr-async-doc %description help # SignalR-Async SignalR-Async is a python client for ASP.NET & ASP.NET Core SignalR, ready for building bidirectional communication. ## Installation ```bash pip install signalr-async ``` ## Example ### Create it - Create a file `main.py` with: ```Python import asyncio from signalr_async.netcore import Hub, Client from signalr_async.netcore.protocols import MessagePackProtocol class MyHub(Hub): async def on_connect(self, connection_id: str) -> None: """Will be awaited after connection established""" async def on_disconnect(self) -> None: """Will be awaited after client disconnection""" def on_event_one(self, x: bool, y: str) -> None: """Invoked by server synchronously on (event_one)""" async def on_event_two(self, x: bool, y: str) -> None: """Invoked by server asynchronously on (event_two)""" async def get_something(self) -> bool: """Invoke (method) on server""" return await self.invoke("method", "arg1", 2) hub = MyHub("my-hub") @hub.on("event_three") async def three(z: int) -> None: pass @hub.on async def event_four(z: int) -> None: pass async def multi_event(z: int) -> None: pass for i in range(10): hub.on(f"event_{i}", multi_event) async def main(): token = "mytoken" headers = {"Authorization": f"Bearer {token}"} async with Client( "https://localhost:9000", hub, connection_options={ "http_client_options": {"headers": headers}, "ws_client_options": {"headers": headers, "timeout": 1.0}, "protocol": MessagePackProtocol(), }, ) as client: return await hub.get_something() asyncio.run(main()) ``` ## Resources See the [SignalR Documentation](https://docs.microsoft.com/aspnet/core/signalr) at docs.microsoft.com for documentation on the latest release. %prep %autosetup -n signalr-async-3.0.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-signalr-async -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue May 30 2023 Python_Bot