Skip to content

查询记录默认生成的Python SDK有BUG #93

Open
@crimsonsky1

Description

@crimsonsky1

链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-table-record/search?appId=cli_a73571c4bdf1d013

使用默认配置,curl可查,官方默认生成的 request如下:

# 构造请求对象
request: SearchAppTableRecordRequest = SearchAppTableRecordRequest.builder() \
    .app_token("xxxx") \
    .table_id("xxxx") \
    .user_id_type("open_id") \
    .page_size(20) \
    .build()

这个请求方法是会报错的 ,报错:
[Lark] [2025-03-01 08:35:07,658] [DEBUG] POST https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal 200, headers: {"User-Agent": "oapi-sdk-python/v1.4.10"}, params: [], body: {"app_id": "cli_a73571c4bdf1d013", "app_secret": "QPlsr77IpEm3jVMaBk2M8cuekmGHLn7y"}
[Lark] [2025-03-01 08:35:08,050] [DEBUG] POST https://open.feishu.cn/open-apis/bitable/v1/apps/Xf77bqPDVa2O4QsHUVLcbKrvn94/tables/tblPSj6KCG6gvSM5/records/search 400, headers: {"User-Agent": "oapi-sdk-python/v1.4.10", "Authorization": "Bearer t-g104318lLGTBEBTPIXEZNNNYTG3BXJPRBRYWR4DO"}, params: [["page_size", "20"]], body: None
[Lark] [2025-03-01 08:35:08,050] [ERROR] client.bitable.v1.app_table_record.search failed, code: 9499, msg: Invalid request parameters. Please check and modify accordingly., log_id: 20250301083507830819CBB35124477343, resp:
{
"code": 9499,
"msg": "Invalid request parameters. Please check and modify accordingly.",
"error": {
"log_id": "20250301083507830819CBB35124477343",
"troubleshooter": "排查建议查看(Troubleshooting suggestions): https://open.feishu.cn/search?from=openapi&log_id=20250301083507830819CBB35124477343&code=9499&method_id=7301628054955556866"
}
}

经过研究,默认curl代码请求发送了空请求体{},但是官方SDK没有发。所以需要加上 " .request_body(SearchAppTableRecordRequestBody.builder().build()) \ " ,就正常了

这个API是我第一个尝试调用的,坑了我两天。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions