Skip to content

fix: read SANKA_API_KEY in SankaClient and fix the README example - #36

Merged
haegwan merged 1 commit into
mainfrom
sdk-agent-friction
Nov 20, 2026
Merged

haegwan merged 1 commit into
mainfrom
sdk-agent-friction

Conversation

@sanka-change-bot

Copy link
Copy Markdown
Contributor

Summary

Fixes what coding agents hit in the published PyPI package, matching the Node SDK change in sankaHQ/sanka-node#36 (Gauge agent evals, 2026-11-19 and 11-20).

  • fern/openapi-overrides.yml gives the bearerAuth scheme x-fern-bearer with env: SANKA_API_KEY and keeps the token argument name. Regenerated with scripts/generate_sdk.sh (Fern python 4.34.0); the only generated change is src/sanka_sdk/client.py: token defaults to os.getenv("SANKA_API_KEY") in SankaClient and AsyncSankaClient, and the constructor raises ApiError when neither is set. A passed token still wins. Python never read SANKA_BEARER_AUTH, so there is no older variable to keep.
  • Known Fern behaviour, documented in the README: the default is read when SankaClient is first imported, so the variable must be set before that import (shell export, or load_dotenv() first).
  • README: the example called client.public_auth.whoami(), which does not exist; it now calls get_public_auth_whoami_api() with SANKA_API_KEY, states the base URL https://api.sanka.com and the 401 error class, and links to the Python SDK guide. Relative links are now absolute GitHub URLs, because PyPI does not resolve them.
  • The Developer Cloud guide used SANKA_API_TOKEN; it now uses SANKA_API_KEY.
  • project.urls adds Documentation (https://sanka.com/docs/developers/sdk-python/) and Issues; Homepage https://sanka.com and Repository were already right.
  • Version stays 0.2.13; a release PR (0.2.14) ships this.

Lines: no test lines; non-test +42 / -13. No new test: the fallback is generator configuration, and the generated client.py diff shows if a regeneration drops it.

Verification: uv build, twine check passed, the wheel installed into an empty venv, SankaClient() with no arguments and only SANKA_API_KEY=dummy-agent-check-key set, then GET https://api.sanka.com/v2/public/auth/whoami:

  • this branch: 401 INVALID_AUTHENTICATION (the key was sent), raised as UnauthorizedError
  • published 0.2.13, same script: TypeError: SankaClient.__init__() missing 1 required keyword-only argument: 'token'
  • no key at all on this branch: ApiError naming SANKA_API_KEY
  • wheel metadata lists Homepage, Documentation, Repository and Issues

Audit

  • Requester: @haegwan
  • Authoring identity: Sanka Change Bot
  • Head SHA: 9e8048c4688f45e313bca2021f27b5e57bf7992b
  • Risk: low
  • Deploy mode: none
  • Production surface: None. Ships in the next sanka-sdk PyPI release (tag v0.2.14 or later).

Validation

  • uv run --frozen -- python -W error -m unittest discover -s tests -v -> passed
  • uv build -> passed
  • uv run --frozen -- python -W error -m unittest discover -s tests: 49 tests OK (1 skipped) -> reported passed
  • Live 401 check from the built wheel, as described in the summary -> reported passed
  • No-local-check reason: N/A
  • Required GitHub checks must complete before landing.
  • Valid review findings must be addressed before landing.

Change Safety

  • Data or migration impact: None. SDK source and docs only.
  • Rollback: Revert the merge commit. Nothing reaches PyPI until a release tag is pushed.
  • Monitoring: Repository deployment helper smoke checks.

Approval And Deployment Authorization

  • The PR is ready for final human review; no intended code changes remain.
  • The listed head SHA is the exact revision being presented for approval.

By approving this PR, the reviewer authorizes merge of the exact approved revision. This repository has no production deployment in this flow. A later push requires a new approval.

- The Fern override gives the bearer scheme env SANKA_API_KEY and keeps the
  token argument, so SankaClient() and AsyncSankaClient() work with only
  SANKA_API_KEY set. A passed token still wins.
- The README example called client.public_auth.whoami(), which does not
  exist; it now calls get_public_auth_whoami_api() with SANKA_API_KEY,
  states the base URL and the 401 error, and uses absolute GitHub links,
  since PyPI does not resolve relative ones.
- The Developer Cloud guide used SANKA_API_TOKEN; it now uses SANKA_API_KEY.
- PyPI lists the Python SDK guide as Documentation and the issue tracker.
@haegwan
haegwan merged commit 1d1be15 into main Nov 20, 2026
7 checks passed
@sanka-change-bot sanka-change-bot Bot mentioned this pull request Nov 20, 2026
2 tasks done
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