Skip to content

Add User-Agent header, logging support, and storage admin helpers#2

Merged
jwfing merged 2 commits intomainfrom
storage-admin-sdks
Mar 30, 2026
Merged

Add User-Agent header, logging support, and storage admin helpers#2
jwfing merged 2 commits intomainfrom
storage-admin-sdks

Conversation

@jwfing
Copy link
Copy Markdown
Member

@jwfing jwfing commented Mar 30, 2026

Summary

  • Add InsForge-Python/{VERSION} User-Agent header to all HTTP requests, matching the pattern used in Kotlin/Swift/Go SDKs
  • Read SDK version from package metadata (importlib.metadata) so pyproject.toml remains the single source of truth
  • Add insforge.setup_logging() helper with INFO (SDK config) and DEBUG (HTTP request/response) levels
  • Add storage admin helpers (bucket CRUD, object upload/download/delete, upload/download strategies)

Test plan

  • All 85 unit tests pass
  • Verify User-Agent header appears in server request logs
  • Verify insforge.setup_logging("DEBUG") prints HTTP request/response details
  • Verify insforge.setup_logging("INFO") prints SDK initialization info

🤖 Generated with Claude Code

Note

Add User-Agent header, logging support, and storage debug logging to the insforge SDK

  • All outgoing HTTP requests now include a User-Agent header of the form InsForge-Python/{VERSION}; passing user-agent in extra_headers is silently ignored.
  • Adds insforge.setup_logging(level) to configure the insforge logger with a StreamHandler, making it easy to enable INFO or DEBUG output without custom logging setup.
  • DEBUG logging is added to BaseClient._request and StorageClient methods, emitting method, URL, params, and status code; request bodies are logged with sensitive fields redacted.
  • Behavioral Change: user-agent is now a reserved header and cannot be overridden via extra_headers.

Macroscope summarized a1328df.

jwfing and others added 2 commits March 30, 2026 09:53
- Add InsForge-Python/{VERSION} User-Agent to all HTTP requests
- Read version from package metadata (importlib.metadata) to keep
  pyproject.toml as single source of truth
- Add logging module with setup_logging() helper for INFO/DEBUG levels
- INFO: SDK initialization config; DEBUG: HTTP request/response details
- Document logging usage in README

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Redact password, token, otp, code, api_key and other credentials
from request body before writing to debug logs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jwfing jwfing merged commit d569e7d into main Mar 30, 2026
6 checks passed
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