Skip to main content

PyWica - Wica Python API

coverage report pipeline status

Table of Contents

Introduction

This project/package aims to provide a simple python interface to the wica-http server. Check out the async branch to get the async version of the package

Installation

Install with pip

pip install wica

Quick-start Guide

import asyncio
import time

from wica import WicaStream


async def simple_example_blocking_io():
    """A simple example of how to use WicaStream.

    In this example we are using asyncio, but you could use any other concurrency or parallel processing package,
    you just need the ability to interrupt the stream somehow!
    Check out the async version of this package!
    """

    wica_stream = WicaStream(base_url="http://student08/ca/streams", channels=["MMAC3:STR:2"])

    def run_stream():
        wica_stream.create()
        for message in wica_stream.subscribe():
            print(message)

    def stop_stream():
        print("Starting to wait")
        time.sleep(5)
        print(wica_stream.destroy())

    # The following functions put the blocking functions into their own thread.
    async def thread_run_stream():
        return await asyncio.to_thread(run_stream)

    async def thread_stop_stream():
        return await asyncio.to_thread(stop_stream)

    return await asyncio.gather(thread_run_stream(), thread_stop_stream())

async def main():
    await simple_example_blocking_io()

if __name__ == "__main__":
    asyncio.run(main())

Documentation

Current Features:

  • Custom Client to handle be able to extract last line of SSE with timestamp and message type.
  • Simple functions to create, delete and subscribe to streams
  • Blocking IO (non-blocking versions available in async branch)

Check out the wiki for more info!

Dependencies

  • requests

Contribute

To contribute, simply clone the project.

Project Changes and Tagged Releases

  • See the Changelog file for further information
  • project releases are available in pypi

Developer Notes

Currently None

Contact

If you have any questions pleas contact 'niklas.laufkoetter@psi.ch'

Metadata

Release files for wica 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wica 1.0.6
File Size Uploaded
wica-1.0.6.tar.gz 20.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wica 1.0.6
File Interpreter ABI Platform
wica-1.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 52.4 kB

Release files / wica-1.0.6.tar.gz

Download URL wica-1.0.6.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d4efede48021400cbcb2fd19f701cd1d6b638b2621764866dc582171f978faad
BLAKE2b-256 checksum
How to use checksums
b8e4911281228d3873558f6458137a059ba106d4b1a4665794afd1ca9188d886
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.11.0 Linux/3.10.0-1160.71.1.el7.x86_64

Release files / wica-1.0.6-py3-none-any.whl

Download URL wica-1.0.6-py3-none-any.whl
Size 32.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
316aa0cfd655e14217e537b24d13ddfb6995ac5f64ce92a0ce729eaf02ed5724
BLAKE2b-256 checksum
How to use checksums
088b20cc9daee78424ee4c35e3d393f07d2dd0c9461daff0df9efbf788bee9c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.11.0 Linux/3.10.0-1160.71.1.el7.x86_64

Release history Release notifications | RSS feed

This release

1.0.6 This release

2 release files

1.0.5

2 release files

1.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page