SuperAPI AI 工具集

telnyx-porting-out-python

编程与开发

查看项目

更新于 10-16 03:37

技能介绍

用途:在号码被转出 Telnyx 时管理 port-out 请求,可列出、查看并更新转出状态,配套 Python SDK 示例。

安装与初始化:pip install telnyx;通过 os.environ.get("TELNYX_API_KEY") 初始化 Telnyx 客户端。

主要能力(对应端点):GET /portouts 列表(返回 auto-paginating iterator,可用 for item in page_result 自动翻页);GET /portouts/{id} 获取单个请求(字段含 status 枚举 pending、authorized、ported、rejected、rejected-pending、canceled 等);GET /portouts/events 与 GET /portouts/events/{id} 查看事件,POST /portouts/events/{id}/republish 重发事件;GET /portouts/rejections/{portout_id} 列出可用的拒绝代码;GET/POST /portouts/reports 及 GET /portouts/reports/{id} 列出、创建和获取报告(report_type: export_portouts_csv);GET/POST /portouts/{id}/comments 列出和创建评论;GET/POST /portouts/{id}/supporting_documents 管理支持文档(type: loa、invoice);PATCH /portouts/{id}/{status} 授权或拒绝请求,需提供 reason,可选 host_messaging。

错误处理:API 调用可能失败,需处理 telnyx.APIConnectionError、telnyx.RateLimitError(429,建议指数退避,参考 Retry-After)、telnyx.APIStatusError(401 密钥无效、403 权限不足、404 资源不存在、422 校验错误)。

限制:资料未说明费率、配额、平台限制或超出上述字段的返回细节;使用需有效的 TELNYX_API_KEY。