Skip to content

Implement sync HTTP client wrapper using httpx #7

Description

@codebestia

Description

All sync resource methods need a shared internal HTTP client. This should wrap httpx.Client, set default headers (Content-Type, Accept, User-Agent), and expose a clean internal interface (get, post, patch, delete) used only by resource classes — never exposed in the public API.

Proposed Steps

  • Create src/shade/http_client.py with class _SyncHTTPClient.
  • Accept api_key, api_base, timeout in the constructor.
  • Implement request(method, path, params, json) that builds the full URL and returns a parsed response dict.
  • Set User-Agent: shade-python/{version} on every request.
  • Use httpx.Client as a context manager internally; keep a single instance alive per ShadeClient.

Acceptance Criteria

  • GET/POST/PATCH/DELETE requests are issued to the correct fully-qualified URLs.
  • User-Agent header is present on every request.
  • Content-Type: application/json is set on POST/PATCH bodies.
  • The client does not expose httpx types in its public interface.
  • Closing a ShadeClient closes the underlying httpx.Client.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions