Description:
The SDK should support module-level configuration (e.g. shade.api_key = "sk_live_...") so developers can configure it once at app startup without instantiating a client object on every call. This mirrors the ergonomics of the Stripe Python SDK. The global config must be thread-safe and readable by all resource classes.
Proposed Steps:
- Create
src/shade/config.py with module-level variables: api_key, api_base, environment, timeout, max_retries.
- Expose these on the top-level
shade namespace via __init__.py.
- Write a
get_config() helper that merges instance-level overrides with global defaults, used internally by all resource methods.
- Guard against
None api_key at request time and raise AuthenticationError.
Acceptance Criteria:
Description:
The SDK should support module-level configuration (e.g.
shade.api_key = "sk_live_...") so developers can configure it once at app startup without instantiating a client object on every call. This mirrors the ergonomics of the Stripe Python SDK. The global config must be thread-safe and readable by all resource classes.Proposed Steps:
src/shade/config.pywith module-level variables:api_key,api_base,environment,timeout,max_retries.shadenamespace via__init__.py.get_config()helper that merges instance-level overrides with global defaults, used internally by all resource methods.Noneapi_key at request time and raiseAuthenticationError.Acceptance Criteria:
shade.api_key = "sk_live_xxx"sets the global key accessible across all resource calls.shade.environment = "sandbox"switches the active environment.shade.api_key = Noneand then calling any resource raisesAuthenticationErrorwith a clear message.