feat(client): default User-Agent header for SDK attribution (DAK-7617) - #189
Merged
Conversation
Set a default `User-Agent: dakera-py/<version>` header on both the sync
(requests) and async (httpx) clients so the Dakera engine's server-side
install telemetry (DAK-7617) can attribute Python SDK usage.
The version is read from installed package metadata via
`importlib.metadata.version("dakera")` to avoid a circular import
(`dakera.__version__` is defined after these modules are imported in
`__init__`), falling back to `dakera-py/unknown`. A caller-supplied
`headers` override still wins, matching existing header-merge behaviour.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sets a default
User-Agent: dakera-py/<version>header on both the synchronous (requests-basedDakeraClient) and asynchronous (httpx-basedAsyncDakeraClient) clients so the Dakera engine's server-side install telemetry (DAK-7617) can attribute Python SDK usage.Details
importlib.metadata.version("dakera")to avoid a circular import —dakera.__version__is defined after these client modules are imported in__init__.py. Falls back todakera-py/unknownif metadata is unavailable (PackageNotFoundError).headers=override still wins via the existing.update(headers)merge.Verification
User-Agentheader is set on both thehttpx.AsyncClientand therequests.Session.User-Agentoverride wins.ruff check(the CI lint step) passes on both files.🤖 Generated with Claude Code