Skip to main content

indexnow-ping

CI PyPI Python License: Apache-2.0

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 submits through IndexNow and optionally Google Search Console:

  • IndexNow — pings api.indexnow.org, which fans out to Bing, Yandex and Seznam.
  • Google Search Console — 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.txt can'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.txt and 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.

Built and maintained by Gexiro Global Enterprises Ltd.

Third-party service and library attribution: see NOTICE.

Part of the Gexiro open-source toolkit.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

indexnow_ping-0.1.1.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

indexnow_ping-0.1.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file indexnow_ping-0.1.1.tar.gz.

File metadata

  • Download URL: indexnow_ping-0.1.1.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for indexnow_ping-0.1.1.tar.gz
Algorithm Hash digest
SHA256 57f45c9f6fdebca762c6efc018d1eaef28174a5c73e8874240a4888625a0f8f7
MD5 c184b48fff803e8bb45734ea1429deab
BLAKE2b-256 5996cac44a87e63db1bf8e0d5bb5a4d42d747675872182dc2a52d12a574d94c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for indexnow_ping-0.1.1.tar.gz:

Publisher: release.yml on gexiro-global/indexnow-ping

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file indexnow_ping-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: indexnow_ping-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for indexnow_ping-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 45d44e792946192370b5393db2003c333cd5029dd1b9617fb20f92da3f8e1073
MD5 a7ba992ac35a10ff637a123e765979fe
BLAKE2b-256 c274cf0819cd94499fd6a9a44be4e7b67b0be648aea58c2d7151b2be4567c5c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for indexnow_ping-0.1.1-py3-none-any.whl:

Publisher: release.yml on gexiro-global/indexnow-ping

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page