dial_sdk.user_agent¶
Functions¶
|
Compose the User-Agent for outgoing requests: the caller's identifier, |
|
Reduce a caller-supplied identifier to something safe to put in a header. |
Module Contents¶
- dial_sdk.user_agent.build_user_agent(stock: str, custom: str | None) str¶
Compose the User-Agent for outgoing requests: the caller’s identifier, when they gave a usable one, ahead of the SDK’s own.
stockis always present — a caller can add to the header but never replace it.
- dial_sdk.user_agent.sanitize_user_agent(raw: str | None) str¶
Reduce a caller-supplied identifier to something safe to put in a header.
This never raises: the prefix is telemetry, so a malformed value degrades to no prefix at all rather than failing the request. That matters concretely — httpx rejects a header value containing CR/LF, so passing one through unsanitized would turn a cosmetic misconfiguration into a hard failure of every Dial call the caller makes.
Returns “” when there is nothing usable left.