Make `async: True` batch searches work out of the box
还没有人认领这个 Issue。
评估
调研方向
Start by reading the implementations of Client.search and Client.search_archive, then check the README examples. Decide whether the contribution will add a helper that submits, polls, and re-queues searches or document that workflow. Done means bulk async searches can be handled with less setup, and archive polling does not reuse the initial search parameters such as q.
由索引模型根据 Issue 内容生成。
描述
Moved from the deprecated google-search-results-python package: https://github.com/serpapi/google-search-results-python/issues/51 (originally reported by dimitryzub).
Original request
From a user perspective, the less setup required the better. [...] The user has to just add an
async: Trueand don't bother tinkering/figuring out stuff for another ~hour about howQueueor something else works.
Today, running async searches in bulk means submitting each search with async: True, keeping the search IDs in a queue, polling the Search Archive API, and re-queueing searches that aren't finished (status other than Cached or Success).
Applies to serpapi-python: Client.search and Client.search_archive expose the building blocks, but the queue and polling logic is left to the user and the README has no helper or example for it.
Proposal: a helper that does this under the hood. The original issue suggested an API along these lines (adapted to the new client):
import serpapi
client = serpapi.Client(api_key="...")
# hypothetical API
results = client.async_search(
queries=["burly", "creator", "doubtful", "minecraft"],
engine="youtube",
device="desktop",
)
Alternatively, a documented README example of the submit, poll and re-queue loop would already help.
One thing to keep in mind from the original thread: when polling the archive, don't reuse the params from the initial search, because passing q to the Search Archive API returns an error.
- 主要语言
- Python
- 星标
- 183
- 派生
- 28
- 平均合并
- 8 天 14 小时
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
serpapi/serpapi-python 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
serpapi/serpapi-python#54 ·
-
improvement
难度 3/5 1-2 天 新手友好度 35/100
serpapi/serpapi-python#17 · 2 条评论 · 1 个 reaction ·
查看 serpapi/serpapi-python 的全部 Issue
相似的 Issue
-
todo
难度 1/5 1 小时以内 新手友好度 72/100
tonybaloney/CSnakes#864 ·
-
infra
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
libre-embedded/svgen#72 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
Genesis-Embodied-AI/genesis-world#3950 ·
维护者通常 1 天内回复
-
accessibility
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复