source
inspect_url_status
def inspect_url_status(
auth:GSCAuth, # Authenticated GSCAuth instance
site_url:str, # GSC property URL
page_url:str, # Page URL to inspect
)->dict:
Inspect URL indexing status from Google Search Console.
from fastcore.test import test_eq
from pprint import pprint
from seo_rat.gsc_client import GSCAuth
from sqlmodel import Session, create_engine, SQLModel
from seo_rat.sqlite_db import get_session
auth = GSCAuth()
# Test inspect_url_status
status = inspect_url_status(auth, "sc-domain:kareemai.com", "https://kareemai.com/")
print(f"Verdict: {status['verdict']}")
test_eq("verdict" in status, True)
pprint(status)
Verdict: PASS
{'coverage_state': 'Submitted and indexed',
'indexing_state': 'INDEXING_ALLOWED',
'last_crawl_time': '2026-04-02T06:59:29Z',
'robots_txt_state': 'ALLOWED',
'verdict': 'PASS'}
source
store_index_status
def store_index_status(
session:Session, # Active database session
auth:GSCAuth, # Authenticated GSCAuth instance
site_url:str, # GSC property URL
page_url:str, # Page URL to inspect and store
)->None:
Inspect and store URL index status as a new history row.
source
get_index_status
def get_index_status(
session:Session, # Active database session
site_url:str, # GSC property URL
verdict:str | None=None, # Optional verdict to filter by
)->list:
Get latest index status per page, optionally filtered by verdict.
source
get_not_indexed_pages
def get_not_indexed_pages(
session:Session, # Active database session
site_url:str, # GSC property URL
)->list:
Get pages whose latest index status is not PASS.
source
get_not_indexed_by_reason
def get_not_indexed_by_reason(
session:Session, # Active database session
site_url:str, # GSC property URL
)->dict:
Group not-indexed pages by their coverage state reason.
source
fetch_sitemap_urls
def fetch_sitemap_urls(
sitemap_url:str, # URL of the sitemap XML
)->list:
Fetch all page URLs from a sitemap XML.
source
store_all_index_status
def store_all_index_status(
session:Session, # Active database session
auth:GSCAuth, # Authenticated GSCAuth instance
site_url:str, # GSC property URL
sitemap_url:str, # URL of the sitemap to process
)->dict:
Check and store index status for all pages in a sitemap.
source
get_index_history
def get_index_history(
session:Session, # Active database session
page_url:str, # Page URL to look up
)->list:
Get full index status history for a page, newest first.