serpapi

The official Python client for SerpApi, returning structured search results from Google, Bing, and more.

SDK
PyPI
v1.1.0
169stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
62/100Good
Development Activity64
Maintenance40
Community68
Maturity56
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture82
Code Quality80
Innovation72
Learning Curve90

serpapi is the official, modern Python wrapper for SerpApi — a hosted service that runs search-engine queries and returns clean, structured JSON. It supersedes the legacy google-search-results package with a cleaner client design centered on a single Client.search() method and a SerpResults object.

SerpApi covers Google (including Maps, Shopping, Images, Scholar, Jobs, and more), Bing, Baidu, Yandex, Yahoo, eBay, app stores, and other engines, exposing web results, flight schedules, stock data, news, and more. The library is designed to feed search data into AI workflows, RAG and fine-tuning pipelines, and general Python applications.

What You Get

  • A unified Client.search() method that works across all supported engines via an engine parameter
  • A dict-like SerpResults model with pagination helpers
  • Environment-variable-based API key configuration
  • Typed exceptions for API and request errors

Common Use Cases

  • Feeding live search results into RAG and LLM-agent pipelines
  • Collecting SERP data for rank tracking, SEO, and market research
  • Querying Google Maps, Shopping, Scholar, and other verticals programmatically

Under The Hood

Architecture - The serpapi/ package is cleanly layered: core.py defines a Client that subclasses HTTPClient (http.py) and exposes search(), returning a SerpResults model (models.py) that wraps the JSON response and adds pagination. exceptions.py defines typed errors, utils.py holds helpers, and textui.py provides light terminal output.

Tech Stack - Pure Python packaged with a modern pyproject.toml, built on requests for HTTP. The repo ships Sphinx docs under docs/, a pylint.rc, and CI workflows.

Code Quality - Testing is extensive: tests/ contains per-engine example tests (Google, Maps, Images, Scholar, Jobs, Bing, Baidu, eBay, and more) plus test_exceptions.py, test_integration.py, and test_timeout.py with a conftest.py. The module boundaries and docstrings are well maintained by the SerpApi team.

API Design - The public API is minimal and pythonic — instantiate serpapi.Client(api_key=...) and call search(q=..., engine=...), or use the module-level serpapi.search() shortcut. Results behave like dicts, keyword and dict params are interchangeable, and the API key is read from an environment variable, making onboarding quick.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search