For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
预约演示登录免费开始
  • 使用 SDK
    • SDK 概述
    • SDK 如何工作
    • Quickstart
    • Customer showcase
  • 使用 SDK
    • 项目结构
    • 添加自定义代码
    • Migrating to Replay
    • 功能特性
  • 参考
      • Generating an SDK
      • 发布到 PyPI
      • Python 配置
      • 添加自定义代码
      • 动态身份验证
      • aiohttp 支持
      • 变更日志
      • Customer showcase
  • 资源
    • generators.yml
Checking status...
SOC2Soc 2 Type II
© 2026 Fern • Birch Solutions, Inc., a Postman company

Documentation

SDKsDocsAsk FernCLI Reference

API Definitions

OpenAPIAsyncAPIOpenRPCgRPC

Resources

BlogSupportPricing

Company

Brand KitPrivacy PolicyTerms of Service
LogoLogo
预约演示登录免费开始
参考Python

Changelog

February 12, 2026
February 12, 2026
此页面是否有帮助?
编辑此页面
上一个

February 13, 2026

下一个

February 11, 2026

4.57.1

(fix): 仅在存在自定义分页端点时将 custom_pagination.py 复制到生成的 SDK 中,仅在存在标准分页端点时复制 pagination.py。

4.57.0

(feat): 添加 custom_transport: true 生成器配置选项,该选项在生成的客户端构造函数上公开一个 http_client 参数,用于自定义 httpx 传输注入。

主要用例: 启用 PKCE(Proof Key for Code Exchange)OAuth 流程和其他需要在传输层进行请求拦截的认证方案。

配置:

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

生成的参数类型:

  • 同步客户端:http_client: typing.Optional[httpx.BaseTransport]
  • 异步客户端:http_client: typing.Optional[httpx.AsyncBaseTransport]

用例:

  • 需要代码质询/验证器注入的 PKCE OAuth 认证流程
  • 自定义请求签名或认证头部操作
  • 请求/响应拦截和修改
  • 用于无网络调用测试的模拟传输
  • 超出内置指数退避的自定义重试逻辑

示例模式(Twilio SDK 风格):

1# SDK 开发者在自定义代码中提供工厂方法
2class ValidationClient:
3 @classmethod
4 def create(cls, account_sid: str, auth_token: str) -> httpx.BaseTransport:
5 # 带有 PKCE 或验证逻辑的自定义传输
6 return CustomValidationTransport(account_sid, auth_token)
7
8# 终端用户使用
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")

此功能允许 SDK 开发者将传输特定逻辑延迟到自定义代码,而生成器只是将传输传递给 httpx.Client/httpx.AsyncClient。