No project description provided
Project description
Async Light Streamer Client
This project is based on lightstreamer-client
Install
pip install async-lightstreamer
# or if you are using poetry
poetry add async-lightstreamer
Task Group
This client creates a task for receving new messages You can pass TaskGroup to LightstreamerClient, and client will use given TaskGroup for creating task
async with asyncio.TaskGroup() as tg:
async_lightstreamer.LightstreamerClient(
lightstreamer_username="<username>",
lightstreamer_password="<password>",
lightstreamer_url="<url>",
adapter_set="<adapter>",
task_group=tg,
)
Reconnect
If you set should_reconnect flag to true in LightstreamerClient, client will reconnect
and subscribe all subscriptions
async_lightstreamer.LightstreamerClient(
lightstreamer_username="<username>",
lightstreamer_password="<password>",
lightstreamer_url="<url>",
adapter_set="<adapter>",
should_reconnect = True,
reconnect_retries = 100, # set to -1 for infitine retry
)
Example
import asyncio
import async_lightstreamer
async def main():
lc = async_lightstreamer.LightstreamerClient(
lightstreamer_username="<username>",
lightstreamer_password="<password>",
lightstreamer_url="<url>",
adapter_set="<adapter>",
)
await lc.connect()
async def callback(data) -> None:
print(data)
await lc.subscribe(
subscription=async_lightstreamer.LightstreamerSubscription(
mode=async_lightstreamer.Mode.MERGE,
items=["item1", "item2"],
fields=["field1", "field2"],
adapter="adapter",
).addlistener(callback),
)
await asyncio.sleep(60)
await lc.disconnect()
asyncio.run(main())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file async_lightstreamer-0.1.1.tar.gz.
File metadata
- Download URL: async_lightstreamer-0.1.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.7 Linux/6.7.4-100.fc38.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d25390dd409025fa378ff98e94a19289f753d9ecb6474ee0bf25d5715430a6ff
|
|
| MD5 |
ff7ae24039c55497e9494e1c146b4b37
|
|
| BLAKE2b-256 |
ea8583183eb1285e49d79b7c3235a5b172ac0e07b0e51589efce8eda3c5dfe4f
|
File details
Details for the file async_lightstreamer-0.1.1-py3-none-any.whl.
File metadata
- Download URL: async_lightstreamer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.7 Linux/6.7.4-100.fc38.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13dd29fbcd6f7ea1fe16071205e8b53415820adc5f9f0d20974c89acc352b691
|
|
| MD5 |
52d775ba6ac51f865082f7d86ad1fb47
|
|
| BLAKE2b-256 |
623e2b807b1505f009b3dabb407564b14d564d73ffb9a20c625cea0eee6bc6e6
|