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
- 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 on your PATH:
pipx install 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
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).analytics query --aggregation-type byPropertycannot be combined withpagegrouping/filtering.
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.0.tar.gz.
File metadata
- Download URL: google_search_console_cli-0.1.0.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85a2013c795da80258e486351df81aa82fbb8a24a5faaa4d4ccb7eb3097a45ac
|
|
| MD5 |
94f406b07e7de3a61beabea5deb1c780
|
|
| BLAKE2b-256 |
5c77bcef6928f38f6a1acc35349d641044e6d7e9b038e32cc40c350324530520
|
File details
Details for the file google_search_console_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: google_search_console_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22898a3ca72b61e78305040a44c17eb035ea74dfbf4c72070f1f681c38f1706b
|
|
| MD5 |
84ddafa9328464df0d37e60029f4f787
|
|
| BLAKE2b-256 |
1e283bbbbe42f8fcb5b210c48747dce243f5238150cbaddfd6f270fb7f231b56
|