tree: 92d080009bf4b9ad463a65e4c8801ccb6c80a584 [path history] [tgz]
  1. docs/
  2. streampipes_client/
  3. tests/
  4. .coveragerc
  5. .gitignore
  6. .pre-commit-config.yaml
  7. DEVELOPMENT.md
  8. Makefile
  9. mkdocs.yml
  10. README.md
  11. setup.py
streampipes-client-python/README.md

:exclamation::exclamation::exclamation:IMPORTANT:exclamation::exclamation::exclamation:

The current version of this Python client is still in alpha phase at best.
This means that it is still heavily under development, which may result in frequent and extensive API changes, unstable behavior, etc.
Please consider it only as a sneak preview.

:exclamation::exclamation::exclamation:IMPORTANT:exclamation::exclamation::exclamation:

⚡️ Quickstart

As a quick example, we demonstrate how to set up and configure a StreamPipes client. In addition, we will get the available data lake measures out of StreamPipes.

>>> from streampipes_client.client import StreamPipesClient
>>> from streampipes_client.client.client_config import StreamPipesClientConfig
>>> from streampipes_client.client.credential_provider import StreamPipesApiKeyCredentials

>>> config = StreamPipesClientConfig(
...    credential_provider=StreamPipesApiKeyCredentials(
...         username="test@streampipes.apache.org",
...         api_key="DEMO-KEY",
...         ),
...     host_address="localhost",
...     http_disabled=True,
...     port=80                  
...)

>>> client = StreamPipesClient(client_config=config)

# get all available datat lake measures
>>> measures = client.dataLakeMeasureApi.all()

# get amount of retrieved measures
>>> len(measures)
1

# inspect the data lake measures as pandas dataframe
>>> measures.to_pandas()
    measure_name timestamp_field  ... pipeline_is_running num_event_properties
0           test   s0::timestamp  ...               False                    2
[1 rows x 6 columns]
>>> from streampipes_client.client.credential_provider import StreamPipesApiKeyCredentials

StreamPipesApiKeyCredentials.from_env(username_env="USER", api_key_env="API-KEY")

username is always the username that is used to log in into StreamPipes.
The api_key can be generated within the UI as demonstrated below:

Howto API Key