Make `async: True` batch searches work out of the box

Aberta
#53 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
55/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
api

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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: True and don't bother tinkering/figuring out stuff for another ~hour about how Queue or 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.

Linguagem predominante
Python
Estrelas
183
Forks
28
Merge médio
8d 14h
PRs com merge (30d)
1

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de serpapi/serpapi-python

Todas as issues de serpapi/serpapi-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.