bossenti commented on code in PR #140: URL: https://github.com/apache/incubator-streampipes/pull/140#discussion_r1020909158
########## streampipes-client-python/README.md: ########## @@ -14,4 +14,84 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ ---> \ No newline at end of file +--> + +# StreamPipes client for Python + +Apache StreamPipes meets Python! We are working highly motivated on a Python-based client to interact with StreamPipes. +In this way, we would like to unite the power of StreamPipes to easily connect to and read different data sources, especially in the IoT domain, +and the amazing universe of data analytics libraries in Python. + +<h1 align="center"> + <br> + <img src="https://raw.githubusercontent.com/apache/incubator-streampipes/STREAMPIPES-607/streampipes-client-python/docs/img/streampipes-python.png" Review Comment: - [ ] adapt link to dev branch when ready to merge, @bossenti ########## streampipes-client-python/README.md: ########## @@ -14,4 +14,84 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ ---> \ No newline at end of file +--> + +# StreamPipes client for Python + +Apache StreamPipes meets Python! We are working highly motivated on a Python-based client to interact with StreamPipes. +In this way, we would like to unite the power of StreamPipes to easily connect to and read different data sources, especially in the IoT domain, +and the amazing universe of data analytics libraries in Python. + +<h1 align="center"> + <br> + <img src="https://raw.githubusercontent.com/apache/incubator-streampipes/STREAMPIPES-607/streampipes-client-python/docs/img/streampipes-python.png" + alt="StreamPipes Logo with Python" title="Apache StreamPipes Logo with Python" width="75%"/> + <br> +</h1> + +<br> + +**:exclamation::exclamation::exclamation:IMPORTANT:exclamation::exclamation::exclamation:** +<br> +<br> +**The current version of this Python client is still in alpha phase at best.** +<br> +**This means that it is still heavily under development, which may result in frequent and extensive API changes, unstable behavior, etc.** +<br> +**Please consider it only as a sneak preview.** +<br> +<br> +**:exclamation::exclamation::exclamation:IMPORTANT:exclamation::exclamation::exclamation:** + +<br> + +## ⚡️ 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. + +```python +>>> 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="[email protected]", +... 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] +``` +<br> +Alternatively, you can provide your credentials via environment variables. +Simply define your credential provider as follows: + +```python +>>> from streampipes_client.client.credential_provider import StreamPipesApiKeyCredentials + +StreamPipesApiKeyCredentials.from_env(username_env="USER", api_key_env="API-KEY") +``` +<br> + +`username` is always the username that is used to log in into StreamPipes. <br> +The `api_key` can be generated within the UI as demonstrated below: + + Review Comment: - [ ] adapt link to dev branch when ready to merge, @bossenti -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
