The RDP SDK for Python is part of the unified SDK family for client applications interacting with Raft Data Platform (RDP). It provides async Python APIs, configuration, authentication, TLS, logging, and timeout helpers for the RDP API surface.
For platform concepts, API guides, and integration details, see https://developer.teamraft.com.
Python 3.12 or newer is required. Install with the Python interpreter you plan to use:
python3 -m pip install \
--extra-index-url https://buf.build/gen/python \
rdp-sdk-pythonIf your system has multiple Python versions, substitute the Python 3.12+ binary in the command above.
The extra index provides the public Python package generated from the
raft/wdm Buf module. The generated package
retains the raft.wdm.v1 import path used below.
export RDP_SERVER_URL=https://rdp.example.com
export RDP_API_KEY=your-api-keyimport asyncio
import rdp_sdk
import structlog
from raft.wdm.v1.service import object_service_pb2
async def main() -> None:
# Load RDP_SERVER_URL and authentication from the environment.
cfg = rdp_sdk.load_config(logger=structlog.get_logger())
# Create a client from the loaded config.
async with rdp_sdk.Client.from_config(cfg, timeout=10.0) as client:
# Request the first 10 WDM objects.
response = await client.object_service.search_objects(
object_service_pb2.SearchObjectsRequest(page_size=10),
)
if not response.objects:
print("No WDM objects found.")
return
for obj in response.objects:
print(f"{obj.id}\t{obj.name}")
asyncio.run(main())For more examples, see examples.
load_config() reads connection settings from environment variables and
returns a validated RdpConfig. Pass a structlog-compatible logger for
validation warnings, and pass env_path to load a dotenv file before
reading the process environment.
| Variable | Required | Description |
|---|---|---|
RDP_SERVER_URL |
No | Base RDP endpoint. Defaults to https://rdp.local; use scheme and host only. |
RDP_SERVER_PORT |
No | Optional port override for the endpoint. |
TLS_SKIP_VERIFY |
No | Set to true only for development or test endpoints with self-signed certificates. |
RDP_PROTOCOL |
No | Optional ConnectRPC protocol override: connect, grpc, grpc_web, or grpc-web. |
API key authentication is the preferred method for client applications. Use OAuth2 client credentials or a static Bearer token only when your deployment requires it.
| Method | Variables | Request behavior |
|---|---|---|
| API key | RDP_API_KEY |
Sends the value on each request as an API key header. |
| OAuth2 client credentials | RDP_CLIENT_ID, RDP_CLIENT_SECRET |
Fetches a token from {RDP_SERVER_URL}/api/v1/auth/token and sends it as a bearer token. |
| Bearer | RDP_BEARER_TOKEN |
Sends Authorization: Bearer <token>. |
Providing multiple auth methods is an error. If no method is configured, requests are sent without auth and the SDK logs a warning.
Pass keyword arguments to Client(...), or use
Client.from_config(cfg, **overrides) to layer programmatic values on top
of a loaded RdpConfig. Overrides win over values loaded from the
environment.
For direct construction:
logger = structlog.get_logger()
async with rdp_sdk.Client(
"https://rdp.example.com",
api_key="your-api-key",
timeout=10.0,
logger=logger,
) as client:
# call generated service clients
...Static Authorization header auth can be configured directly as well:
async with rdp_sdk.Client(
"https://rdp.example.com",
bearer_token="token",
) as bearer_client:
...For environment-first configuration with programmatic overrides:
cfg = rdp_sdk.load_config(env_path=".env.local", logger=logger)
async with rdp_sdk.Client.from_config(
cfg,
timeout=10.0,
) as client:
# call generated service clients
...Use client_id and client_secret only when your deployment requires
OAuth2 client credentials. Use tls_skip_verify=True only for development
or test endpoints with self-signed certificates. Pass protocol=... only
when you need to force a specific ConnectRPC protocol.