Skip to content

feat(client): default User-Agent header for SDK attribution (DAK-7617) - #189

Merged
ferhimedamine merged 1 commit into
mainfrom
feat/dak-7617-user-agent
Jul 29, 2026
Merged

feat(client): default User-Agent header for SDK attribution (DAK-7617)#189
ferhimedamine merged 1 commit into
mainfrom
feat/dak-7617-user-agent

Conversation

@ferhimedamine

Copy link
Copy Markdown
Contributor

Summary

Sets a default User-Agent: dakera-py/<version> header on both the synchronous (requests-based DakeraClient) and asynchronous (httpx-based AsyncDakeraClient) clients so the Dakera engine's server-side install telemetry (DAK-7617) can attribute Python SDK usage.

Details

  • Version is read from installed package metadata via importlib.metadata.version("dakera") to avoid a circular import — dakera.__version__ is defined after these client modules are imported in __init__.py. Falls back to dakera-py/unknown if metadata is unavailable (PackageNotFoundError).
  • The header is added to the initial default-headers literal, so a caller-supplied headers= override still wins via the existing .update(headers) merge.
  • Applied identically to both clients (they build headers independently; no shared code path).

Verification

  • Imported both clients from source — no circular import.
  • Confirmed the User-Agent header is set on both the httpx.AsyncClient and the requests.Session.
  • Confirmed a caller-supplied User-Agent override wins.
  • ruff check (the CI lint step) passes on both files.

🤖 Generated with Claude Code

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>
@ferhimedamine
ferhimedamine merged commit 9969cdf into main Jul 29, 2026
5 checks passed
@ferhimedamine
ferhimedamine deleted the feat/dak-7617-user-agent branch July 29, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant