Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Travis Coveralls PyPi

sensorbee-python

This is a Python client library for SensorBee REST / WebSocket API. This library also provides utility commands (sbstat and sbpeek) which can be used to inspect SensorBee topology.

Install

pip install sensorbee-python

To use WebSocket Client API, you also need to install websocket-client:

pip install websocket-client

Requirements

  • Python 2.7, 3.3, 3.4, 3.5 or 3.6.

Usage

Python API

In most cases the only class you need to use is pysensorbee.api.SensorBeeAPI. Here is an example:

from pysensorbee import SensorBeeAPI

api = SensorBeeAPI('127.0.0.1', 15601)
api.create_topology('test')
api.query('test', 'CREATE SOURCE ns TYPE node_statuses;')
for r in api.query('test', 'SELECT RSTREAM * FROM ns [RANGE 1 TUPLES];'):
  print(r)

See pydoc pysensorbee.api for details.

Commands

sbstat provides a brief summary of the topology status.

$ sbstat -H 127.0.0.1 -P 15601 -t test
   Node                          Status    Received   Error   Output                            Sent     Queued   Dropped
-> node_stats                    running                      (total)                           5381                    0
                                                                  sensorbee_tmp_8               5381   0 (0.0%)
:: sensorbee_tmp_8               running       5381       0   (total)                           5381                    0
                                                                  sensorbee_tmp_select_sink_7   5381   0 (0.0%)
<- sensorbee_tmp_select_sink_7   running       5381       0

Sources, streams and sinks are indicated by ->, :: and <-, respectively.

sbpeek can be used to peek what tuple is currently running through the specified source or stream.

$ sbpeek -H 127.0.0.1 -P 15601 -t test -1 node_stats
{"behaviors": {"remove_on_stop": false, "stop_on_disconnect": false}, "node_type": "source", "output_stats": {"num_sent_total": 5893, "outputs": {"sensorbee_tmp_58": {"queue_size": 1024, "num_sent": 0, "num_queued": 0}, "sensorbee_tmp_8": {"queue_size": 1024, "num_sent": 5893, "num_queued": 0}}, "num_dropped": 0}, "state": "running", "node_name": "node_stats"}

See sbstat --help and sbpeek --help for details.

Notice

  • This library is not a part of the official SensorBee project.

  • In addition to APIs documented in the API Specification Version 1, this library supports some undocumented APIs, including WebSocket API.

  • This project is a successor of beepy.

License

MIT License

Metadata

Release files for sensorbee-python 0.3.2

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

Source distribution (sdist)

Source distribution for sensorbee-python 0.3.2
File Size Uploaded
sensorbee-python-0.3.2.tar.gz 10.7 kB Details

Release files / sensorbee-python-0.3.2.tar.gz

Download URL sensorbee-python-0.3.2.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
62cf44f1cc8fd26d4f863d466cf156935ff7d1a0ee3737f0e19847d504cadb06
BLAKE2b-256 checksum
How to use checksums
85116edf0e788c943c0891274710330dea8fb0845d7b08d7b757d02811e285de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
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