larksuite / larksuite/oapi-sdk-python

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

Open
#93 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
559
Forks
102
PR merge metrics
No merged PRs in 30d

Description

链接: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是我第一个尝试调用的,坑了我两天。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the generated SearchAppTableRecordRequest implementation and its request serialization path. Reproduce the Bitable record-search call against the linked endpoint using the default configuration, then verify that the request includes the empty JSON body described in the report and no longer returns error 9499.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.