The Anedya Nexus SDK lets Python applications communicate with Anedya Cloud, including from within a spark function runtime. It currently provides a synchronous client for submitting variable readings over gRPC (the default) or HTTP.
pip install anedya-nexus-sdkSet your API key in the environment rather than hard-coding it in your application:
export ANEDYA_API_KEY="your-api-key"If initializing the SDK from a Spark function, SDK automatically inherits the authentication context from the Spark runtime, so you do not need to set an API key in that case.
Then submit a variable reading:
import time
from anedya.nexus import AnedyaClient, VariableReading
reading = VariableReading(
node_id="your-node-id",
variable="temperature",
timestamp=int(time.time() * 1000),
float_value=23.5,
)
with AnedyaClient() as client:
response = client.data_management.submit_data(reading)
if not response.success:
raise RuntimeError(
f"Data submission failed: {response.error_message} "
f"({response.reason_code})"
)timestamp is a Unix timestamp in milliseconds. You can also pass an API key directly with AnedyaClient(api_key="...").
To configure a custom domain, pass base_url to AnedyaClient. To use HTTP instead of gRPC, pass transport="http".
- Anedya documentation
- GitHub repository
- License (Apache-2.0)
