4.57.1

(fix): Only copy custom_pagination.py into generated SDKs when custom pagination endpoints are present, and only copy pagination.py when standard pagination endpoints are present.

4.57.0

(feat): Add custom_transport: true generator config option that exposes an http_client parameter on generated client constructors for custom httpx transport injection.

Primary use case: Enables PKCE (Proof Key for Code Exchange) OAuth flows and other authentication schemes that require request interception at the transport layer.

Configuration:

1generators:
2 - name: fernapi/fern-python-sdk
3 config:
4 custom_transport: true

Generated parameter types:

  • Sync client: http_client: typing.Optional[httpx.BaseTransport]
  • Async client: http_client: typing.Optional[httpx.AsyncBaseTransport]

Use cases:

  • PKCE OAuth authentication flows requiring code challenge/verifier injection
  • Custom request signing or authentication header manipulation
  • Request/response interception and modification
  • Mock transports for testing without network calls
  • Custom retry logic beyond the built-in exponential backoff

Example pattern (Twilio SDK style):

1# SDK developer provides a factory method in custom code
2class ValidationClient:
3 @classmethod
4 def create(cls, account_sid: str, auth_token: str) -> httpx.BaseTransport:
5 # Custom transport with PKCE or validation logic
6 return CustomValidationTransport(account_sid, auth_token)
7
8# End-user usage
9from myapi import MyClient, ValidationClient
10
11validation_transport = ValidationClient.create("account_sid", "auth_token")
12client = MyClient(http_client=validation_transport, base_url="https://api.example.com")

This feature allows SDK developers to defer transport-specific logic to custom code while the generator simply threads the transport through to httpx.Client/httpx.AsyncClient.