Do not raise error for search archive results

未关闭
#17 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
ruby
领域
api

调研方向

Start in lib/serpapi/client.rb, especially the get handling around lines 154 and 236. Trace how archive search responses with HTTP 200 and a top-level "error" key are processed, then verify that failed searches can be retrieved without raising an error condition.

由索引模型根据 Issue 内容生成。

描述

If the HTTP response code is 200, we should not raise an error condition. In practice, trying to investigate a set of failed searches is impossible with the client as it currently works. Consider the following:

Processing IDs from failed-searches.txt...
--------------------------------------------------------------------------------
Search ID                      | Created At                | Processed At              | Time Taken
--------------------------------------------------------------------------------
6935c0b9a0cb1015d74ef919: Error - HTTP request failed with status: 200 OK error: Google hasn't returned any results for this query. from url: https://serpapi.com/searches/6935c0b9a0cb1015d74ef919.json
6935c10c6372f3288d198835: Error - HTTP request failed with status: 200 OK error: Google hasn't returned any results for this query. from url: https://serpapi.com/searches/6935c10c6372f3288d198835.json
6935c140d1a72b12298a4c3a: Error - HTTP request failed with status: 200 OK error: Google hasn't returned any results for this query. from url: https://serpapi.com/searches/6935c140d1a72b12298a4c3a.json
6935c1847dcfbe884d95f202: Error - HTTP request failed with status: 200 OK error: Google hasn't returned any results for this query. from url: https://serpapi.com/searches/6935c1847dcfbe884d95f202.json
6935c23c0fa72e068915493a: Error - HTTP request failed with status: 200 OK error: Google hasn't returned any results for this query. from url: https://serpapi.com/searches/6935c23c0fa72e068915493a.json
6935c26f80c963a0739496b7: Error - HTTP request failed with status: 200 OK error: Google hasn't returned any results for this query. from url: https://serpapi.com/searches/6935c26f80c963a0739496b7.json
6935c2a2d99612e9a0b828b2: Error - HTTP request failed with status: 200 OK error: Google hasn't returned any results for this query. from url: https://serpapi.com/searches/6935c2a2d99612e9a0b828b2.json

The search exists, the response was successful, but because of the search api using the same get machinery:

https://github.com/serpapi/serpapi-ruby/blob/024b9ebe3320704a117d46043a49238c8dc14ddc/lib/serpapi/client.rb#L154

It uses the same handling of the presence of a top level "error" key:

https://github.com/serpapi/serpapi-ruby/blob/024b9ebe3320704a117d46043a49238c8dc14ddc/lib/serpapi/client.rb#L236

Instead, we should allow retrieval of failed searches from the archive without raising an error.

主要语言
Ruby
星标
35
派生
20
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。