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())
Release files for async-lightstreamer 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| async_lightstreamer-0.1.7.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_lightstreamer-0.1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / async_lightstreamer-0.1.7.tar.gz
| Download URL | async_lightstreamer-0.1.7.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
606075fb08bea351a2c15deacb52e009ea1aa292b4b3a5ede67876c28ce1256e
|
|
BLAKE2b-256 checksum How to use checksums |
2995f9978628adbc9ee253828baa72bdfad64a803d830e766f9bc91fcaf0207f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.11.7 Linux/6.7.4-100.fc38.x86_64
|
Release files / async_lightstreamer-0.1.7-py3-none-any.whl
| Download URL | async_lightstreamer-0.1.7-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78aa3e00a1534e4025cfab3c4f870a5dc659631eca0dd9bcdea690eaf1285ccd
|
|
BLAKE2b-256 checksum How to use checksums |
696d917365dcdb8b96ec164def02427327c5be2fcf82428f66be36f697365a4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.11.7 Linux/6.7.4-100.fc38.x86_64
|