Skip to main content

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

async_lightstreamer-0.1.3.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

async_lightstreamer-0.1.3-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file async_lightstreamer-0.1.3.tar.gz.

File metadata

  • Download URL: async_lightstreamer-0.1.3.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

Hashes for async_lightstreamer-0.1.3.tar.gz
Algorithm Hash digest
SHA256 154f213ffa83ce63e37664f2bf5318a4a4482d8b2a5185ba0e2a9ff44f9b9afe
MD5 f94176c2eae50666ac7636e9a8ce6f29
BLAKE2b-256 078626580f5f2136f6d7c4fe0ba34b1df3f74c27048f3961ad54f269fd05c825

See more details on using hashes here.

File details

Details for the file async_lightstreamer-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: async_lightstreamer-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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

Hashes for async_lightstreamer-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f870fd66925ed2b5fd56e289ef98d538feddfdab8228a6e3c00b955b20b9aaa6
MD5 0553b1c474a0e0eee5157812edb3d1e2
BLAKE2b-256 de65d3703ca666a4579a7f6dd9cfe6bf9494f0f8e89cd5937580309a152c82d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page