Python Client Support for Streamdal
Welcome to the Python Client Guide for Streamdal! If you’re leveraging the power of Python and aim to enhance your data operations, you’re on the right track. Integrating Streamdal into your Python applications is both efficient and straightforward with our Python SDK.
For detailed information on the Python SDK and its functionalities, refer to the Python SDK README.
Instrumentation
Start with the instrumentation guide if you haven’t already. It will walk you through the process of setting up Streamdal and its components.
Getting Started
- Install the SDK package:
python -m pip install streamdal
Prerequisites
Ensure you have Python 3.8 or later installed on your system.
Example
Here’s a basic example to help you get started with Streamdal Python SDK:
import pprint
from streamdal import (OPERATION_TYPE_CONSUMER, ProcessRequest, StreamdalClient, StreamdalConfig)
client = StreamdalClient(
cfg=StreamdalConfig(
service_name="order-ingest",
streamdal_url="streamdal-server.svc.cluster.local:8082",
streamdal_token="1234",
)
)
res = client.process(
ProcessRequest(
operation_type=OPERATION_TYPE_CONSUMER,
operation_name="new-order-topic",
component_name="kafka",
data=b'{"object": {"field": true}}',
)
)
pprint.pprint(res)
This example demonstrates how to initialize a new instance of the Streamdal SDK, and how to process data through a method call.
You simply need to create a configuration object and a process request object, and then call the process method on a new Streamdal instance. The result will be printed to the console.
Libraries
Libraries/shims are TBA for Python.