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

Abierto
#53 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
api

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
183
Forks
28
Merge medio
8 d 14 h
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de serpapi/serpapi-python

Todos los issues de serpapi/serpapi-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.