I Built a Google Autocomplete Keyword Tool in Python (Source Code Included)

Published: (January 8, 2026 at 07:44 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Why Google Autocomplete?

Google Autocomplete is one of the most honest keyword datasets available.

  • Every suggestion comes from real searches
  • It reflects user intent
  • It surfaces long‑tail queries early

Under the hood, most SEO tools call the same endpoint:

https://suggestqueries.google.com/complete/search

KeySage connects to it directly — no API, no authentication.

High‑Level Architecture

KeySage is a single‑process desktop app with a background scraping thread.

ComponentTechnology
UI layerTkinter + ttkbootstrap
Networkingrequests
Concurrencythreading + Event flags
Data modelset + defaultdict
ExportsTXT / CSV / JSON

The goal was simplicity and hackability.

The Scraping Logic

Each base keyword goes through a configurable expansion pipeline:

  1. Base keyword input
  2. Optional prepend/append words
  3. Character expansion: a–z and a–z + 0–9
  4. Google Autocomplete request
  5. Deduplication
  6. Live UI update

Example request

params = {
    "client": "firefox",
    "q": query,
    "hl": language,
    "gl": country
}
response = requests.get(
    "https://suggestqueries.google.com/complete/search",
    params=params
)

Results are streamed back to the UI using app.after() to keep Tkinter thread‑safe.

Threading Without Freezing the UI

Tkinter is single‑threaded, so scraping runs in a background thread.

Key patterns used:

  • threading.Thread(..., daemon=True)
  • threading.Event() for safe cancellation
  • UI updates marshaled back to the main loop via app.after()

This allows:

  • Real‑time keyword output
  • Instant cancellation
  • No UI hangs

Rate Limiting & Stability

Google doesn’t love aggressive scraping. KeySage includes:

  • Built‑in delays between requests
  • Optional proxy support
  • Stop‑safe execution at every loop

These measures keep the app usable without being reckless.

Automatic Keyword Clustering

After scraping, keywords are grouped by root word:

root = keyword.split()[0].lower()
clusters[root].append(keyword)

Clusters are preserved across all export formats.

Exporting Data (Developer‑Friendly)

Supported formats:

  • TXT – human‑readable clusters
  • CSV – SEO tools & spreadsheets
  • JSON – automation & pipelines

Everything stays open and editable.

UI: Tkinter, But Not Ugly

The interface uses ttkbootstrap to avoid the default Tkinter look.

Features:

  • Responsive layout
  • Themed widgets
  • Collapsible advanced settings
  • Live scrolling output
  • Built‑in help window

It’s intentionally minimal — no Electron, no web stack.

EXE vs Source Code

Three options are offered:

OptionPriceDescription
Windows EXE$7Run instantly, no Python required
Full Source Code$10Learn, modify, extend
EXE + Source$12Best of both

👉 Get KeySage here:

Why Release the Source Code?

Developers learn best from real tools — not toy examples. With the source you can:

  • Add async requests
  • Improve clustering
  • Add new export formats
  • Integrate other suggestion sources
  • Turn it into a CLI or API

The project is meant to be a foundation.

Final Thoughts

KeySage isn’t trying to replace enterprise SEO platforms. It’s a transparent, hackable keyword tool built with:

  • Python
  • Common libraries
  • Simple architecture
  • No vendor lock‑in

If you want a practical example of a real‑world scraping + desktop app — or a tool you can actually use — this is for you.

👉 Buy / Download KeySage:

Back to Blog

Related posts

Read more »

Building a Secure Password Manager

Overview This project is a secure desktop password manager built using Python and Tkinter. It stores and manages credentials locally with strong encryption and...