Repository navigation
fix: read SANKA_API_KEY in SankaClient and fix the README example - #36
Merged
Merged
Conversation
- 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
approved these changes
Nov 20, 2026
2 tasks done
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
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.ymlgives thebearerAuthschemex-fern-bearerwithenv: SANKA_API_KEYand keeps thetokenargument name. Regenerated withscripts/generate_sdk.sh(Fern python 4.34.0); the only generated change issrc/sanka_sdk/client.py:tokendefaults toos.getenv("SANKA_API_KEY")inSankaClientandAsyncSankaClient, and the constructor raisesApiErrorwhen neither is set. A passed token still wins. Python never readSANKA_BEARER_AUTH, so there is no older variable to keep.SankaClientis first imported, so the variable must be set before that import (shell export, orload_dotenv()first).client.public_auth.whoami(), which does not exist; it now callsget_public_auth_whoami_api()withSANKA_API_KEY, states the base URLhttps://api.sanka.comand the 401 error class, and links to the Python SDK guide. Relative links are now absolute GitHub URLs, because PyPI does not resolve them.SANKA_API_TOKEN; it now usesSANKA_API_KEY.project.urlsadds Documentation (https://sanka.com/docs/developers/sdk-python/) and Issues; Homepage https://sanka.com and Repository were already right.Lines: no test lines; non-test +42 / -13. No new test: the fallback is generator configuration, and the generated
client.pydiff shows if a regeneration drops it.Verification:
uv build,twine checkpassed, the wheel installed into an empty venv,SankaClient()with no arguments and onlySANKA_API_KEY=dummy-agent-check-keyset, thenGET https://api.sanka.com/v2/public/auth/whoami:INVALID_AUTHENTICATION(the key was sent), raised asUnauthorizedErrorTypeError: SankaClient.__init__() missing 1 required keyword-only argument: 'token'ApiErrornamingSANKA_API_KEYAudit
@haegwanSanka Change Bot9e8048c4688f45e313bca2021f27b5e57bf7992blownoneNone. 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-> passeduv build-> passeduv run --frozen -- python -W error -m unittest discover -s tests: 49 tests OK (1 skipped)-> reported passedLive 401 check from the built wheel, as described in the summary-> reported passedChange Safety
Approval And Deployment Authorization