indexnow-ping — safe sitemap submission for IndexNow and Google Search Console
Tell the search engines your site changed — without accidentally announcing a site that isn't live yet.
indexnow-ping reads a site's own sitemap.xml, then:
- IndexNow — pings
api.indexnow.org, which fans out to Bing, Yandex and Seznam. - Google Search Console (optional) — resubmits the sitemap via the GSC API.
Before it pings anything it runs a pre-launch guard: it fetches robots.txt
and aborts if the site still blocks every crawler (User-agent: * + Disallow: /).
Staging and not-yet-launched sites therefore can't be leaked to the index by a
stray cron run. That guard is the reason this exists.
pip install indexnow-ping # IndexNow only (pure standard library)
pip install "indexnow-ping[gsc]" # + Google Search Console support
Use
# IndexNow ping; key read from a file or the environment
indexnow-ping example.com --indexnow-key-file /etc/indexnow/example.key
INDEXNOW_KEY=abc123... indexnow-ping example.com
# also resubmit the sitemap to Google Search Console
indexnow-ping example.com \
--indexnow-key-file /etc/indexnow/example.key \
--gsc-key-file /etc/gsc/service-account.json
# a pre-launch site (robots blocks all) exits 1 and pings nothing:
indexnow-ping staging.example.com --indexnow-key K # -> GUARD: ... abort ; exit 1
# override deliberately with --force
The IndexNow key is a token you also
serve at https://<domain>/<key>.txt; it is not a secret, but keep it out of your
repo (a --indexnow-key-file / INDEXNOW_KEY is cleaner than a flag in shell
history). The GSC service-account JSON is sensitive — pass a path, never commit it.
Options
| Flag / env | Meaning |
|---|---|
--sitemap URL |
sitemap URL (default https://<domain>/sitemap.xml; must be same-site) |
--indexnow-key / --indexnow-key-file / INDEXNOW_KEY / INDEXNOW_KEY_FILE |
the IndexNow key |
--gsc-key-file / GSC_KEY_FILE |
Google service-account JSON (enables the GSC layer) |
--limit N |
max URLs to submit (default 200) |
--timeout S |
per-request timeout |
--force |
skip the pre-launch robots guard |
Exit codes: 0 submitted, 1 pre-launch guard aborted, 2 usage error, 3 ran
but nothing submitted (no key/URLs, unavailable sitemap, or all submissions failed).
Design notes
- Guard fails closed. If
robots.txtcan't be fetched, or blocks all crawlers, the run aborts rather than pinging. - Same-site only. Every URL — and every child sitemap in a sitemap-index — is checked to belong to the target host before it is followed or submitted, so a tampered sitemap can't make the tool ping arbitrary hosts. A sitemap-index is followed one level; its child-sitemap links are never mistaken for page URLs.
- URLs come from the site. The tool never invents URLs; it submits exactly what
the sitemap lists (capped by
--limit). A valid but empty sitemap submits nothing, and an unavailable sitemap is not treated as an empty one — it aborts the IndexNow submission rather than announcing a synthesized URL. - Redirects stay on-site. HTTP redirects for
robots.txtand sitemaps are followed only within the target site; a cross-origin redirect is an error, so a redirecting endpoint cannot bypass the guard or point the tool at another host. - Optional heavy dep. IndexNow is standard-library only; the Google client is imported lazily and required solely for the GSC layer.
Tests
pip install -e ".[dev]"
pytest -q
The suite injects a fake fetcher and stubs the HTTP calls, so it exercises the real guard/parsing/same-site/flow logic with no network access.
License
Apache-2.0 © 2026 Gexiro Global Enterprises Ltd. See NOTICE
for third-party service and library attribution.
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 indexnow_ping-0.1.0.tar.gz.
File metadata
- Download URL: indexnow_ping-0.1.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
696b0ed65253f2c464d7756d5f15b73ad77bd71a737401b907a73d6918127718
|
|
| MD5 |
11dce1e6d903a4cb4fb3c236f36846ff
|
|
| BLAKE2b-256 |
a268d9db6c0accb70eca53ce54540b399a0e1b7d94b9950d06f692aa05493b00
|
File details
Details for the file indexnow_ping-0.1.0-py3-none-any.whl.
File metadata
- Download URL: indexnow_ping-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ead3fb911f3b082b0a7d5b42758eaa11f78c60253e297787f5664f6fa1f1027
|
|
| MD5 |
bd4f5ad89dafc21fbb4cd13226cd368e
|
|
| BLAKE2b-256 |
42563cc4fd75f5d7e86657903bed6ca2faf556bf8f27ecfa3885a2492561bfec
|