A simple python API to access wica-http SSE.
Project description
PyWica - Wica Python API
Table of Contents
- Introduction
- Installation
- Quick-start Guid
- Documentation
- Dependencies
- Contribute
- Project Changes and Tagged Releases
- Developer Notes
- Contact
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'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wica-1.0.6.tar.gz
(20.1 kB
view details)
Built Distribution
wica-1.0.6-py3-none-any.whl
(32.3 kB
view details)
File details
Details for the file wica-1.0.6.tar.gz
.
File metadata
- Download URL: wica-1.0.6.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.11.0 Linux/3.10.0-1160.71.1.el7.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4efede48021400cbcb2fd19f701cd1d6b638b2621764866dc582171f978faad |
|
MD5 | 31c8b26532c1fb45405d141b61cdd355 |
|
BLAKE2b-256 | b8e4911281228d3873558f6458137a059ba106d4b1a4665794afd1ca9188d886 |
File details
Details for the file wica-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: wica-1.0.6-py3-none-any.whl
- Upload date:
- Size: 32.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.11.0 Linux/3.10.0-1160.71.1.el7.x86_64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 316aa0cfd655e14217e537b24d13ddfb6995ac5f64ce92a0ce729eaf02ed5724 |
|
MD5 | 61a391ee2a7d9e9bc280cb88d0310bd2 |
|
BLAKE2b-256 | 088b20cc9daee78424ee4c35e3d393f07d2dd0c9461daff0df9efbf788bee9c8 |