Summary
The Python SDK client currently supports two overlapping ways to set API key auth: Config(api_key=...) (required, falls back to CG_API_KEY) and an optional Auth passed to the client. When both are set, the explicit Auth wins and Config.api_key goes unused. This came out of review on common-grants/py-cg-grants-gov#13, where the docs example passed the same key twice.
Two consequences today:
- It's not obvious to consumers which path wins, and docs examples have duplicated the key.
Config requires api_key unconditionally, so a client using Auth.bearer(...) still has to supply an unused API key.
For comparison, the TS SDK takes auth only through the auth option and ClientConfig carries no key.
Flagged for the next minor release of the Python SDK.
Acceptance criteria
- Direction decided and recorded on this ticket (single canonical auth surface, or keep both paths and document precedence).
- Python SDK client, README, and examples updated to match the decision.
Summary
The Python SDK client currently supports two overlapping ways to set API key auth:
Config(api_key=...)(required, falls back toCG_API_KEY) and an optionalAuthpassed to the client. When both are set, the explicitAuthwins andConfig.api_keygoes unused. This came out of review on common-grants/py-cg-grants-gov#13, where the docs example passed the same key twice.Two consequences today:
Configrequiresapi_keyunconditionally, so a client usingAuth.bearer(...)still has to supply an unused API key.For comparison, the TS SDK takes auth only through the
authoption andClientConfigcarries no key.Flagged for the next minor release of the Python SDK.
Acceptance criteria