The client to connect to StreamPipes.
This is the central point of contact with StreamPipes and provides all the functionalities to interact with it.
The client provides so-called "endpoints" each of which refers to an endpoint of the StreamPipes API, e.g. .dataLakeMeasureApi
. An endpoint provides the actual methods to interact with StreamPipes API.
client_config
Configures the client to connect properly to the StreamPipes instance.
TYPE: StreamPipesClientConfig
logging_level
Influences the log messages emitted by the StreamPipesClient
TYPE: Optional[int]
DEFAULT: logging.INFO
Examples:
from streampipes.client import StreamPipesClient
from streampipes.client.config import StreamPipesClientConfig
from streampipes.client.credential_provider import StreamPipesApiKeyCredentials
client_config = StreamPipesClientConfig(
credential_provider=StreamPipesApiKeyCredentials(
username="test-user",
api_key="api-key"
),
host_address="localhost",
https_disabled=True
)
The following way of instantiating a client instance is intended to be consistent with the StreamPipes Java client.
client = StreamPipesClient.create(client_config=client_config)
If you prefer a more pythonic way, you can simply write:
client = StreamPipesClient(client_config=client_config)
To interact with an endpoint:
data_lake_measures = client.dataLakeMeasureApi.all()
To inspect returned data as a pandas dataframe:
data_lake_measures.to_pandas()
#
# measure_name timestamp_field ... pipeline_is_running num_event_properties
# 0 test s0::timestamp ... False 2
# [1 rows x 6 columns]
base_api_path: str
property
¶
Constructs the basic API URL from the given client_config
.
base_api_path
basic API path of the connected StreamPipes instance
TYPE: str
Returns the HTTP headers used for all requests.
The HTTP headers are composed of the authentication headers supplied by the credential provider and additional required headers (currently this is only the application header).
RETURNS DESCRIPTIONhttp_headers
header information for HTTP requests as string key-value pairs.
TYPE: Dict[str, str]
create(client_config, logging_level=logging.INFO)
classmethod
¶
Returns an instance of the StreamPipesPythonClient
.
Provides consistency to the StreamPipes Java client.
PARAMETER DESCRIPTIONclient_config
Configures the client to connect properly to the StreamPipes instance.
TYPE: StreamPipesClientConfig
logging_level
Influences the log messages emitted by the StreamPipesClient
.
TYPE: int
DEFAULT: logging.INFO
describe()
¶
Prints a short description of the connected StreamPipes instance and the available resources to the console.
Examples:
Output:
Hi there!
You are connected to a StreamPipes instance running at http://localhost:80.
The following StreamPipes resources are available with this client:
6x DataStreams
1x DataLakeMeasures
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4