Skip to content

Update RequestX adapter for v1.0.2 with httpx-like API#1

Merged
wuqunfei merged 4 commits into
mainfrom
claude/update-requestx-adapter-9eWE7
Jan 27, 2026
Merged

Update RequestX adapter for v1.0.2 with httpx-like API#1
wuqunfei merged 4 commits into
mainfrom
claude/update-requestx-adapter-9eWE7

Conversation

@wuqunfei
Copy link
Copy Markdown
Member

Summary

Updates the RequestX HTTP client adapter to support RequestX 1.0.2, which introduces an httpx-compatible API. This change modernizes the adapter to use the new Client and AsyncClient classes instead of the previous Session API.

Key Changes

  • Dependency Update: Bumped minimum RequestX version from 0.1.0 to 1.0.2 in pyproject.toml
  • API Migration: Replaced requestx.Session() with requestx.Client() for sync operations and requestx.AsyncClient() for async operations
  • Parameter Updates: Changed request parameter from data to content to match httpx API conventions
  • SSL Verification: Moved verify_ssl from per-request to client initialization via verify parameter
  • Async Cleanup: Updated async context manager exit to use await self.async_client.aclose() instead of synchronous close()
  • Streaming Support: Implemented proper streaming with client.stream() and async_client.stream() context managers, replacing the previous fallback behavior
  • Response Timing: Simplified response time calculation to use response.elapsed.total_seconds() for sync requests (when available) and manual timing for async requests
  • Chunk Counting: Improved chunk count calculation for streamed responses based on actual content size

Implementation Details

  • Removed unused time import from module level (now imported locally in streaming methods)
  • Updated docstrings to reflect RequestX 1.0.2 and its httpx-like API
  • Renamed internal attributes from session/async_session to client/async_client for clarity
  • Added verify_ssl as instance variable initialized during client creation
  • Streaming methods now properly iterate through response chunks using iter_bytes() and aiter_bytes() with 8KB chunk size

https://claude.ai/code/session_018m5XH5sVYS25zAr6258ygf

- Changed from Session() to Client() for sync and AsyncClient() for async
- Added proper aclose() for async client cleanup
- Switched from 'data' to 'content' parameter for request body
- Added native streaming support using stream() method with iter_bytes/aiter_bytes
- Added verify_ssl attribute initialization
- Updated pyproject.toml to require requestx>=1.0.2

https://claude.ai/code/session_018m5XH5sVYS25zAr6258ygf
Reformatted to match httpx adapter style exactly:
- Single line docstrings
- Inline method call parameters
- Consistent code structure

https://claude.ai/code/session_018m5XH5sVYS25zAr6258ygf
- Updated requestx adapter for v1.0.3 API (httpx-like interface)

https://claude.ai/code/session_018m5XH5sVYS25zAr6258ygf
@wuqunfei wuqunfei merged commit 4056b2a into main Jan 27, 2026
1 check failed
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.

2 participants