惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 【当耐特】
S
Schneier on Security
Blog — PlanetScale
Blog — PlanetScale
MyScale Blog
MyScale Blog
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
The GitHub Blog
The GitHub Blog
腾讯CDC
A
About on SuperTechFans
H
Help Net Security
The Register - Security
The Register - Security
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
V
Visual Studio Blog
T
Tailwind CSS Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - Franky
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
D
DataBreaches.Net
I
InfoQ
L
Lohrmann on Cybersecurity
M
MIT News - Artificial intelligence
I
Intezer
博客园 - 聂微东
Webroot Blog
Webroot Blog
宝玉的分享
宝玉的分享
Scott Helme
Scott Helme
Microsoft Security Blog
Microsoft Security Blog
SecWiki News
SecWiki News
Hacker News: Ask HN
Hacker News: Ask HN
T
Troy Hunt's Blog
S
Security @ Cisco Blogs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
N
Netflix TechBlog - Medium
小众软件
小众软件
The Cloudflare Blog
WordPress大学
WordPress大学
N
News | PayPal Newsroom
C
Check Point Blog
Google Online Security Blog
Google Online Security Blog
月光博客
月光博客
C
Cisco Blogs
阮一峰的网络日志
阮一峰的网络日志
W
WeLiveSecurity
Schneier on Security
Schneier on Security

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How to Track Local SEO Rankings by City with an API
Cecilia Hill · 2026-06-16 · via DEV Community

Local SEO rankings are not the same everywhere.

Your website may rank in position 2 in Austin, position 8 in Dallas, and not appear at all in Chicago.

That is why checking one generic Google result is not enough for local SEO.

If you are working on local SEO, agency reporting, competitor monitoring, or location-based search analysis, you need to track rankings by city.

A simple workflow looks like this:

Keyword + city → SERP API → local search results → ranking check → CSV report

In this tutorial, we’ll build a basic Python script that tracks local SEO rankings by city using a SERP API.

We will:

  1. Define target keywords
  2. Define target cities
  3. Send city-specific searches to a SERP API
  4. Extract organic results
  5. Check where a target domain appears
  6. Save the ranking data to CSV

This is not a full SEO platform, but it gives you the core logic behind many local rank tracking tools.

Why city-level rankings matter

Google search results are location-sensitive.

A query like:

best digital marketing agency

may return different results in:

New York
Austin
London
Singapore
Sydney

This matters even more for local intent keywords, such as:

dentist near me
plumber in Chicago
coffee shop in Austin
real estate agent in Miami

For these searches, the result page can include:

  • organic results
  • local packs
  • Google Maps results
  • ads
  • business directories
  • review sites
  • service pages
  • location-specific landing pages

If you only check one location, you may miss what users actually see in other cities.

For local SEO, ranking data without location context is incomplete.

Why use a SERP API?

You could try to check Google rankings manually.

But that does not scale.

You could also try to scrape Google directly, but that brings a lot of maintenance work:

  • changing page layouts
  • CAPTCHA
  • blocked requests
  • proxy handling
  • inconsistent HTML
  • location mismatch
  • parser updates
  • retry logic

A SERP API gives you structured search results in JSON.

Instead of parsing raw HTML, you get data like this:

{
  "query": "plumber in Austin",
  "location": "Austin, Texas, United States",
  "organic_results": [
    {
      "position": 1,
      "title": "Austin Plumbing Services",
      "link": "https://example.com",
      "snippet": "Local plumbing services in Austin..."
    }
  ]
}

That is much easier to use in Python.

What we are building

Let’s say we want to track whether this target domain appears in city-level Google results:

example.com

We want to test keywords such as:

plumber
emergency plumber
water heater repair

Across cities such as:

Austin, Texas, United States
Dallas, Texas, United States
Houston, Texas, United States

For each keyword and city, we want to know:

  • keyword
  • city
  • target domain
  • whether the domain was found
  • ranking position
  • result title
  • result URL
  • snippet

Example CSV output:

keyword,city,target_domain,found,position,title,url
plumber,Austin,example.com,yes,3,Example Plumbing,https://example.com/austin
plumber,Dallas,example.com,no,,,
emergency plumber,Houston,example.com,yes,7,Emergency Plumbing,https://example.com/houston

Install dependencies

We only need two packages:

pip install requests python-dotenv

requests is used to call the SERP API.

python-dotenv is used to load API keys from a .env file.

Create a .env file

Create a file named .env:

SERP_API_KEY=your_api_key_here
SERP_API_URL=https://your-serp-api-endpoint.example.com/search

Do not hardcode API keys in your script.

In this tutorial, we will use a generic SERP API request format. Providers may use different parameter names, so adjust the request based on the API you use.

Create keyword and city lists

Create a file named keywords.txt:

plumber
emergency plumber
water heater repair

Create another file named cities.txt:

Austin, Texas, United States
Dallas, Texas, United States
Houston, Texas, United States

Each line is one keyword or one target city.

Basic SERP API request

Create a file named local_rank_tracker.py.

import os
import requests
from dotenv import load_dotenv


load_dotenv()

SERP_API_KEY = os.getenv("SERP_API_KEY")
SERP_API_URL = os.getenv("SERP_API_URL")


def fetch_google_results(query, location, language="en"):
    if not SERP_API_KEY:
        raise ValueError("Missing SERP_API_KEY environment variable")

    if not SERP_API_URL:
        raise ValueError("Missing SERP_API_URL environment variable")

    params = {
        "api_key": SERP_API_KEY,
        "engine": "google",
        "q": query,
        "location": location,
        "language": language,
        "output": "json",
    }

    response = requests.get(SERP_API_URL, params=params, timeout=30)
    response.raise_for_status()

    return response.json()

The exact parameters may vary depending on your provider.

Some APIs may use:

q
query
gl
hl
country
city
location
locale
device
engine

The idea is the same: send a keyword and location, then get structured search results back.

Extract organic results

Most SERP APIs return organic results under a key such as:

organic_results
organic
results

Let’s make the parser flexible.

def get_organic_results(data):
    possible_keys = [
        "organic_results",
        "organic",
        "results",
    ]

    for key in possible_keys:
        value = data.get(key)
        if isinstance(value, list):
            return value

    return []

Now normalize each organic result.

def normalize_result(item):
    return {
        "position": item.get("position") or item.get("rank"),
        "title": item.get("title") or "",
        "url": item.get("link") or item.get("url") or "",
        "snippet": item.get("snippet") or item.get("description") or "",
    }

This gives us a consistent format even if different APIs use slightly different field names.

Extract the domain from a URL

To check rankings, we need to compare the target domain with each result URL.

Use urllib.parse:

from urllib.parse import urlparse


def extract_domain(url):
    if not url:
        return ""

    parsed = urlparse(url)
    domain = parsed.netloc.lower()

    if domain.startswith("www."):
        domain = domain[4:]

    return domain

This turns:

https://www.example.com/austin/plumbing

into:

example.com

Find the target domain ranking

Now we can check whether the target domain appears in the results.

def find_domain_ranking(results, target_domain):
    target_domain = target_domain.lower().replace("www.", "")

    for result in results:
        result_domain = extract_domain(result.get("url", ""))

        if result_domain == target_domain or result_domain.endswith("." + target_domain):
            return {
                "found": "yes",
                "position": result.get("position"),
                "title": result.get("title"),
                "url": result.get("url"),
                "snippet": result.get("snippet"),
            }

    return {
        "found": "no",
        "position": "",
        "title": "",
        "url": "",
        "snippet": "",
    }

This supports exact domain matches and subdomains.

For example, it can match:

example.com
www.example.com
blog.example.com

Load keywords and cities

Add this helper function:

def load_lines(filename):
    with open(filename, "r", encoding="utf-8") as file:
        return [
            line.strip()
            for line in file
            if line.strip()
        ]

Now we can load:

keywords = load_lines("keywords.txt")
cities = load_lines("cities.txt")

Save results to CSV

Add a CSV helper:

import csv


def save_to_csv(rows, filename="local_rankings.csv"):
    fieldnames = [
        "keyword",
        "city",
        "target_domain",
        "found",
        "position",
        "title",
        "url",
        "snippet",
    ]

    with open(filename, mode="w", newline="", encoding="utf-8") as file:
        writer = csv.DictWriter(file, fieldnames=fieldnames)
        writer.writeheader()

        for row in rows:
            writer.writerow(row)

Full script

Here is the complete version:

import os
import csv
import requests
from urllib.parse import urlparse
from dotenv import load_dotenv


load_dotenv()

SERP_API_KEY = os.getenv("SERP_API_KEY")
SERP_API_URL = os.getenv("SERP_API_URL")


def fetch_google_results(query, location, language="en"):
    if not SERP_API_KEY:
        raise ValueError("Missing SERP_API_KEY environment variable")

    if not SERP_API_URL:
        raise ValueError("Missing SERP_API_URL environment variable")

    params = {
        "api_key": SERP_API_KEY,
        "engine": "google",
        "q": query,
        "location": location,
        "language": language,
        "output": "json",
    }

    response = requests.get(SERP_API_URL, params=params, timeout=30)
    response.raise_for_status()

    return response.json()


def get_organic_results(data):
    possible_keys = [
        "organic_results",
        "organic",
        "results",
    ]

    for key in possible_keys:
        value = data.get(key)
        if isinstance(value, list):
            return value

    return []


def normalize_result(item):
    return {
        "position": item.get("position") or item.get("rank"),
        "title": item.get("title") or "",
        "url": item.get("link") or item.get("url") or "",
        "snippet": item.get("snippet") or item.get("description") or "",
    }


def extract_domain(url):
    if not url:
        return ""

    parsed = urlparse(url)
    domain = parsed.netloc.lower()

    if domain.startswith("www."):
        domain = domain[4:]

    return domain


def find_domain_ranking(results, target_domain):
    target_domain = target_domain.lower().replace("www.", "")

    for result in results:
        result_domain = extract_domain(result.get("url", ""))

        if result_domain == target_domain or result_domain.endswith("." + target_domain):
            return {
                "found": "yes",
                "position": result.get("position"),
                "title": result.get("title"),
                "url": result.get("url"),
                "snippet": result.get("snippet"),
            }

    return {
        "found": "no",
        "position": "",
        "title": "",
        "url": "",
        "snippet": "",
    }


def load_lines(filename):
    with open(filename, "r", encoding="utf-8") as file:
        return [
            line.strip()
            for line in file
            if line.strip()
        ]


def save_to_csv(rows, filename="local_rankings.csv"):
    fieldnames = [
        "keyword",
        "city",
        "target_domain",
        "found",
        "position",
        "title",
        "url",
        "snippet",
    ]

    with open(filename, mode="w", newline="", encoding="utf-8") as file:
        writer = csv.DictWriter(file, fieldnames=fieldnames)
        writer.writeheader()

        for row in rows:
            writer.writerow(row)


def track_local_rankings(target_domain, keywords, cities, language="en"):
    rows = []

    for city in cities:
        for keyword in keywords:
            query = f"{keyword} in {city.split(',')[0]}"

            print(f"Checking: {query} | Location: {city}")

            try:
                data = fetch_google_results(
                    query=query,
                    location=city,
                    language=language,
                )

                organic_items = get_organic_results(data)
                normalized_results = [
                    normalize_result(item)
                    for item in organic_items
                ]

                ranking = find_domain_ranking(
                    results=normalized_results,
                    target_domain=target_domain,
                )

                rows.append({
                    "keyword": keyword,
                    "city": city,
                    "target_domain": target_domain,
                    "found": ranking["found"],
                    "position": ranking["position"],
                    "title": ranking["title"],
                    "url": ranking["url"],
                    "snippet": ranking["snippet"],
                })

            except requests.RequestException as error:
                print(f"Request failed: {query} | {city}")
                print(error)

                rows.append({
                    "keyword": keyword,
                    "city": city,
                    "target_domain": target_domain,
                    "found": "error",
                    "position": "",
                    "title": "",
                    "url": "",
                    "snippet": "",
                })

    return rows


if __name__ == "__main__":
    target_domain = "example.com"

    keywords = load_lines("keywords.txt")
    cities = load_lines("cities.txt")

    rankings = track_local_rankings(
        target_domain=target_domain,
        keywords=keywords,
        cities=cities,
        language="en",
    )

    save_to_csv(rankings, "local_rankings.csv")

    print("Saved local ranking results to local_rankings.csv")

Run it:

python local_rank_tracker.py

You should get a CSV file:

local_rankings.csv

Example CSV output

Your output may look like this:

keyword,city,target_domain,found,position,title,url,snippet
plumber,Austin Texas United States,example.com,yes,3,Example Plumbing Austin,https://example.com/austin,Local plumbing services in Austin
plumber,Dallas Texas United States,example.com,no,,,,
emergency plumber,Houston Texas United States,example.com,yes,8,Emergency Plumbing Houston,https://example.com/houston,24/7 plumbing service

This gives you a basic city-level ranking report.

Track competitors by city

You can also track competitor domains.

For example:

target_domains = [
    "example.com",
    "competitor-one.com",
    "competitor-two.com",
]

Then loop through them:

all_rows = []

for domain in target_domains:
    rankings = track_local_rankings(
        target_domain=domain,
        keywords=keywords,
        cities=cities,
        language="en",
    )

    all_rows.extend(rankings)

save_to_csv(all_rows, "competitor_local_rankings.csv")

Now you can compare which domains appear most often across cities.

This can help answer questions like:

  • Which competitor ranks in most cities?
  • Which cities are weak for our domain?
  • Which keywords need local landing pages?
  • Which markets have the strongest competition?

Track city-level visibility score

A simple ranking position is useful, but sometimes you want a summary metric.

For example:

position 1 = 10 points
position 2 = 9 points
position 3 = 8 points
...
position 10 = 1 point
not found = 0 points

Add a scoring function:

def calculate_visibility_score(position):
    if not position:
        return 0

    try:
        position = int(position)
    except ValueError:
        return 0

    if 1 <= position <= 10:
        return 11 - position

    return 0

Add it when creating the row:

score = calculate_visibility_score(ranking["position"])

Then include:

"visibility_score": score

This gives you a simple way to compare local visibility across cities.

Save city visibility summary

If you want to summarize visibility by city, you can calculate totals after collecting rows.

from collections import defaultdict


def summarize_by_city(rows):
    summary = defaultdict(int)

    for row in rows:
        city = row["city"]
        position = row.get("position")
        summary[city] += calculate_visibility_score(position)

    return [
        {
            "city": city,
            "visibility_score": score,
        }
        for city, score in summary.items()
    ]

Then save it:

city_summary = summarize_by_city(rankings)
save_to_csv(city_summary, "city_visibility_summary.csv")

If you use a different CSV structure for summaries, create a separate save function:

def save_city_summary(rows, filename="city_visibility_summary.csv"):
    fieldnames = [
        "city",
        "visibility_score",
    ]

    with open(filename, mode="w", newline="", encoding="utf-8") as file:
        writer = csv.DictWriter(file, fieldnames=fieldnames)
        writer.writeheader()

        for row in rows:
            writer.writerow(row)

This is a simple but useful local SEO metric.

Using local ranking data with an LLM

Once you have local ranking data, you can feed it into an LLM to generate summaries.

Example prompt:

You are a local SEO analyst.

Here is city-level ranking data for our domain and competitors.

Summarize:
- where our domain ranks well
- which cities are weak
- which competitors appear most often
- which keywords need more local content
- what actions we should consider next

This can be useful for:

  • local SEO reports
  • agency client updates
  • competitor research
  • market expansion planning
  • automated weekly summaries

The key is to give the LLM structured ranking data, not raw search pages.

What to check before choosing a SERP API

Before choosing a SERP API provider, test it with your real local queries.

Do not only test one easy keyword.

Try:

plumber in Austin
dentist near me
coffee shop in Seattle
real estate agent in Miami
best hotel near Times Square

Then check:

  • Does the API return clean JSON?
  • Does location targeting work correctly?
  • Are titles, URLs, snippets, and positions available?
  • Are local packs or maps results included if needed?
  • Can you request HTML for debugging?
  • Are failed requests billed?
  • How much cleanup does your code need?
  • Does the output fit your reporting workflow?

Providers such as SerpApi, Serper, SearchAPI, Bright Data, DataForSEO, and Talordata can all be tested for local ranking workflows.

The best provider is not always the one with the longest feature list.

It is the one that gives you usable local ranking data with the least extra work.

Common improvements

This script is only a starting point.

You could improve it by adding:

  • scheduled daily or weekly runs
  • database storage
  • Google Maps local pack parsing
  • mobile vs desktop tracking
  • country and language controls
  • competitor visibility scores
  • Slack or email alerts
  • ranking history charts
  • city-level dashboards
  • AI-generated SEO reports

For example, a weekly report could say:

example.com ranks in the top 3 for "plumber" in Austin and Houston, but is missing from the top 10 in Dallas.

That is much more useful than a generic ranking check.

Final thoughts

Local SEO ranking is location-specific.

A single Google result does not tell you how your domain performs across cities.

With Python and a SERP API, you can build a simple workflow to track rankings by keyword, city, and domain.

The core process is:

Keyword + city → SERP API → structured results → domain match → CSV report

From there, you can add competitor tracking, visibility scoring, city summaries, dashboards, and AI-generated reports.

If you want to test this workflow, Talordata is one SERP API worth comparing. Its official pages describe geo-targeted SERP data, JSON / HTML output, Maps search type support, and 1,000 free API responses after signup.