CLI for Google Search Console
Project description
google-search-console-cli
CLI for Google Search Console using the official Google API Python client.
Highlights
- Native OAuth login: no mandatory
gcloudsetup pipx-friendly install (gscavailable globally)- Site operations: list/get/add
- Sitemap operations: list/get/submit/delete
- URL inspection: manual index-status checks for specific pages
- Analytics queries by date/query/page with Search Console filters
- Output formats: table, json, csv
- Diagnostics:
gsc doctor
Install (Recommended)
Install with pipx so gsc is available globally on your PATH.
If you do not have pipx yet:
python3 -m pip install --user pipx
python3 -m pipx ensurepath
Restart your shell, then install:
pipx install google-search-console-cli
Verify:
gsc --version
Upgrade later:
pipx upgrade google-search-console-cli
Uninstall:
pipx uninstall google-search-console-cli
Install From Source
If you cloned this repository and want to run from source, use one of these options.
Option 1: Local virtualenv (best for development)
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Fish shell activation:
. .venv/bin/activate.fish
Then run:
gsc --help
Option 2: Install from source with pipx (best for day-to-day CLI usage)
pipx install -e /absolute/path/to/google-search-console-cli
OAuth Setup (Recommended)
Create a Google OAuth client of type Desktop app, then run:
gsc auth login --client-secret /absolute/path/to/client_secret.json
Verify:
gsc auth whoami
gsc doctor
Optional: Set Default Site
gsc config set default-site sc-domain:example.com
gsc config get default-site
After this, you can omit --site in commands that need a property.
Usage
Sites
gsc site list
gsc site get --site sc-domain:example.com
gsc site add --site sc-domain:example.com
Sitemaps
gsc sitemap list --site sc-domain:example.com
gsc sitemap get --site sc-domain:example.com --feedpath https://example.com/sitemap.xml
gsc sitemap submit --site sc-domain:example.com --feedpath https://example.com/sitemap.xml
gsc sitemap delete --site sc-domain:example.com --feedpath https://example.com/sitemap.xml
URL Inspection
gsc url inspect --site sc-domain:example.com --url https://example.com/page
Get full response in JSON:
gsc url inspect \
--site sc-domain:example.com \
--url https://example.com/page \
--output json
Analytics
gsc analytics query \
--site sc-domain:example.com \
--start-date 2026-01-01 \
--end-date 2026-01-31 \
--dimension date \
--dimension query \
--filter query:contains:brand \
--filter device:equals:MOBILE
Save as CSV:
gsc analytics query \
--site sc-domain:example.com \
--start-date 2026-01-01 \
--end-date 2026-01-31 \
--dimension page \
--output csv \
--csv-path ./analytics.csv
Filter Syntax
Use repeatable filters in this format:
dimension:operator:expression
Supported filter dimensions:
countrydevicepagequerysearchAppearance
Supported operators:
containsequalsnotContainsnotEqualsincludingRegexexcludingRegex
Convenience Script (Repo Local)
If you cloned this repo and want one command setup:
./scripts/setup.sh /absolute/path/to/client_secret.json
Credentials and Config Paths
By default:
- Credentials:
~/.config/gsc-cli/credentials.json - Config:
~/.config/gsc-cli/config.json
Override with env vars:
GSC_CREDENTIALS_FILEGSC_APP_CONFIG_FILEGSC_CONFIG_DIR
ADC Fallback (Optional)
If you prefer ADC via gcloud, the CLI still supports it:
gcloud auth application-default login \
--client-id-file=/absolute/path/to/client_secret.json \
--scopes=https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/webmasters
Notes
- Use Search Console property formats like
sc-domain:example.comor URL-prefix properties. site addrequires write scope (webmasters).sitemap submitandsitemap deleterequire write scope (webmasters).url inspectuses URL Inspection API for manual status checks only (no general "request indexing" endpoint in Search Console API).analytics query --aggregation-type byPropertycannot be combined withpagegrouping/filtering.
Publishing
Trusted Publishing via GitHub Actions (Recommended)
This repo includes .github/workflows/publish.yml that:
- builds
sdist+wheel - publishes to PyPI using OpenID Connect (no API token needed in GitHub secrets)
To enable it:
- In PyPI, open project settings for
google-search-console-cli. - Add a Trusted Publisher with:
- Owner:
NmadeleiDev - Repository:
google-search-console-cli - Workflow name:
publish.yml - Environment name:
pypi
- Owner:
- In GitHub, keep/create environment
pypi(optional protection rules as you prefer).
Release flow:
- Bump version in
pyproject.toml. - Commit and push.
- Create and push a tag like
v0.1.1:
git tag v0.1.1
git push origin v0.1.1
The workflow will publish automatically.
Manual Publishing (Fallback)
. .venv/bin/activate.fish
python -m build
python -m twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file google_search_console_cli-0.1.1.tar.gz.
File metadata
- Download URL: google_search_console_cli-0.1.1.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d291504ae4dbf869017efdfee9f4aef4c9b7ed920d5f504df72a154680e4740d
|
|
| MD5 |
bf26907908f9897924477ea72ac83d67
|
|
| BLAKE2b-256 |
6a061b3ff18336c9a1fdb8cb01eccc29ae07968c7d57bee693958d63b5ef74d4
|
Provenance
The following attestation bundles were made for google_search_console_cli-0.1.1.tar.gz:
Publisher:
publish.yml on NmadeleiDev/google-search-console-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
google_search_console_cli-0.1.1.tar.gz -
Subject digest:
d291504ae4dbf869017efdfee9f4aef4c9b7ed920d5f504df72a154680e4740d - Sigstore transparency entry: 962242820
- Sigstore integration time:
-
Permalink:
NmadeleiDev/google-search-console-cli@19a572c6385ab96ebca11cd011fb7e8818aa0ba5 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/NmadeleiDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@19a572c6385ab96ebca11cd011fb7e8818aa0ba5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file google_search_console_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: google_search_console_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
350fc81c3045c9333a4e29f7cc85721a005d98ff4da78adae0694c97fd01ca8e
|
|
| MD5 |
c41064b03e86b6f0c0f430e6cbe7a2b0
|
|
| BLAKE2b-256 |
f3520092b34495e4c575ca8550293def4c2e90097a2dcc80635e6705afd7c5de
|
Provenance
The following attestation bundles were made for google_search_console_cli-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on NmadeleiDev/google-search-console-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
google_search_console_cli-0.1.1-py3-none-any.whl -
Subject digest:
350fc81c3045c9333a4e29f7cc85721a005d98ff4da78adae0694c97fd01ca8e - Sigstore transparency entry: 962242823
- Sigstore integration time:
-
Permalink:
NmadeleiDev/google-search-console-cli@19a572c6385ab96ebca11cd011fb7e8818aa0ba5 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/NmadeleiDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@19a572c6385ab96ebca11cd011fb7e8818aa0ba5 -
Trigger Event:
push
-
Statement type: