Skip to content

Repository files navigation

TalorData Google Local SERP API for Python

TalorData Google Local SERP API

TalorData SERP API helps you retrieve structured Google Local SERP data through a Python workflow for local SEO monitoring, business listing research, competitor analysis, location intelligence, AI applications, and lead generation. The workflow extracts key result fields, including business names, addresses, ratings, and ranking positions, so you can use the data in local SEO dashboards, agency reports, prospecting workflows, AI agents, and automation pipelines.

TalorData Google Local SERP

Prerequisites

To run this tool, you need Python 3.11 or newer and a TalorData SERP token.

Get your API key:Sign up at TalorData and get your API key from the dashboard.

Installation

python -m pip install poetry==1.8.2

poetry install

Getting the Google Local input

This tool collects Google Local results through TalorData SERP API.

Use google_local when you want the local pack-style result list.

For a Local request:

engine=google_local

The request requires a query with q, such as q=coffee or q=foie gras.

The local Google Local page preview looks like this:

Google Local SERP page preview

The TalorData request parameters are summarized here:

TalorData Google Local input example

Running the SERP request

Set your TalorData token first. Choose the command for your terminal.

On Windows Command Prompt:

set TALORDATA_SERP_API_TOKEN=<your_talordata_serp_token>

echo %TALORDATA_SERP_API_TOKEN%

On Windows PowerShell:

$env:TALORDATA_SERP_API_TOKEN="<your_talordata_serp_token>"

$env:TALORDATA_SERP_API_TOKEN

On macOS or Linux:

export TALORDATA_SERP_API_TOKEN=<your_talordata_serp_token>

echo "$TALORDATA_SERP_API_TOKEN"

To collect Google Local results as CSV, run:

poetry run talordata-google-local-serp \
  --query "coffee" \
  --output places.csv \
  --format csv

To collect JSON instead:

poetry run talordata-google-local-serp \
  --query "coffee" \
  --output places.json

To inspect the raw TalorData SERP response while exporting:

poetry run talordata-google-local-serp \
  --query "coffee" \
  --output places.csv \
  --format csv \
  --debug-response raw-response.json

After running the command, the terminal output should look similar to this:

TalorData Google Local terminal output

When the tool finishes, you should see a places.csv or places.json file in the directory where you ran it.

If you choose CSV, open places.csv in Excel, Google Sheets, or any text editor. It should have these columns:

title,place_id,link,address,phone,website,rating,reviews,type,gps_coordinates,position
"Boucherie West Village","ChIJq58thpNZwokRcsvqjnNzYcc","https://example.com","99 7th Ave S, New York, NY 10014","(212) 837-1616","https://example.com",4.8,9426,"French restaurant","40.733047,-74.0028772",1

A generated CSV preview looks like this:

TalorData Google Local CSV output

Each row is one place result. Use CSV for place lists and JSON when you need full nested Google Local metadata.

Notes

This project does not fetch Google Local HTML directly. TalorData SERP API handles upstream fetching, request routing, parsing, and structured JSON output.

If Google returns an upstream no-result response, the CLI surfaces that error instead of silently writing an empty output file.

TalorData Google Local SERP API

TalorData Google Local SERP API returns structured place data such as place names, IDs, addresses, phone numbers, websites, ratings, review counts, place types, coordinates, thumbnails, and rank positions.

Request sample

The same API request is shown here as a quick visual reference:

import os
from pprint import pprint

import requests


payload = {
    "engine": "google_local",
    "q": "coffee",
    "location": "United States",
    "json": "2",
    "output_format": "json",
    "google_domain": "google.com",
    "gl": "us",
    "hl": "en",
}

response = requests.post(
    "https://serpapi.talordata.net/serp/v1/request",
    headers={
        "Authorization": f"Bearer {os.environ['TALORDATA_SERP_API_TOKEN']}",
        "Content-Type": "application/x-www-form-urlencoded",
    },
    data=payload,
    timeout=30,
)

response.raise_for_status()
pprint(response.json())

Supported Google Local parameters:

  • q
  • engine
  • google_domain
  • gl
  • hl
  • location
  • uule
  • ll
  • start
  • num
  • type
  • place_id
  • data_id
  • device
  • no_cache

The output cleaner supports local_results[] and TalorData envelope responses where JSON is nested inside data, result, response, or json.

Development

Run the CLI help:

poetry run talordata-google-local-serp --help

Learn more

Explore TalorData SERP API integrations and use cases:

Quick Start

View Documentation

About

Python workflow example for retrieving structured Google Local search data for local SEO and business-listing research.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages