diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-15 07:20:36 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-15 07:20:36 +0000 |
commit | fc1e7daa29dab99160bbb928f29a4db41b830509 (patch) | |
tree | 72a2fc6365127ca21427e1610b67d0827145c8f7 | |
parent | e50ed0e94759bc81677cf96bf932699e9cfaa90e (diff) |
automatic import of python-signalr-async
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-signalr-async.spec | 371 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 373 insertions, 0 deletions
@@ -0,0 +1 @@ +/signalr-async-3.0.0.tar.gz diff --git a/python-signalr-async.spec b/python-signalr-async.spec new file mode 100644 index 0000000..a23ec0e --- /dev/null +++ b/python-signalr-async.spec @@ -0,0 +1,371 @@ +%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 + +<p align="center"> +<a href="https://app.travis-ci.com/sam-mosleh/signalr-async" target="_blank"> + <img src="https://app.travis-ci.com/sam-mosleh/signalr-async.svg?branch=master" alt="Test"> +</a> + +<a href="https://codecov.io/gh/sam-mosleh/signalr-async"> + <img src="https://codecov.io/gh/sam-mosleh/signalr-async/branch/master/graph/badge.svg?token=JYBKXSFAX6"/> +</a> + +<a href="https://pypi.org/project/signalr-async/" target="_blank"> + <img src="https://img.shields.io/pypi/v/signalr-async" alt="Package version"> +</a> +<a href="https://pypi.org/project/signalr-async/" target="_blank"> + <img src="https://img.shields.io/pypi/pyversions/signalr-async.svg" alt="Supported Python versions"> +</a> +</p> + +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 + +<p align="center"> +<a href="https://app.travis-ci.com/sam-mosleh/signalr-async" target="_blank"> + <img src="https://app.travis-ci.com/sam-mosleh/signalr-async.svg?branch=master" alt="Test"> +</a> + +<a href="https://codecov.io/gh/sam-mosleh/signalr-async"> + <img src="https://codecov.io/gh/sam-mosleh/signalr-async/branch/master/graph/badge.svg?token=JYBKXSFAX6"/> +</a> + +<a href="https://pypi.org/project/signalr-async/" target="_blank"> + <img src="https://img.shields.io/pypi/v/signalr-async" alt="Package version"> +</a> +<a href="https://pypi.org/project/signalr-async/" target="_blank"> + <img src="https://img.shields.io/pypi/pyversions/signalr-async.svg" alt="Supported Python versions"> +</a> +</p> + +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 + +<p align="center"> +<a href="https://app.travis-ci.com/sam-mosleh/signalr-async" target="_blank"> + <img src="https://app.travis-ci.com/sam-mosleh/signalr-async.svg?branch=master" alt="Test"> +</a> + +<a href="https://codecov.io/gh/sam-mosleh/signalr-async"> + <img src="https://codecov.io/gh/sam-mosleh/signalr-async/branch/master/graph/badge.svg?token=JYBKXSFAX6"/> +</a> + +<a href="https://pypi.org/project/signalr-async/" target="_blank"> + <img src="https://img.shields.io/pypi/v/signalr-async" alt="Package version"> +</a> +<a href="https://pypi.org/project/signalr-async/" target="_blank"> + <img src="https://img.shields.io/pypi/pyversions/signalr-async.svg" alt="Supported Python versions"> +</a> +</p> + +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 +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 3.0.0-1 +- Package Spec generated @@ -0,0 +1 @@ +9fc65f2330e98366c21a4984cddd2152 signalr-async-3.0.0.tar.gz |