# Index Tracking


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/index_tracking.py#L22"
target="_blank" style="float:right; font-size:smaller">source</a>

### inspect_url_status

``` python

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.*

``` python
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'}

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/index_tracking.py#L40"
target="_blank" style="float:right; font-size:smaller">source</a>

### store_index_status

``` python

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.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/index_tracking.py#L53"
target="_blank" style="float:right; font-size:smaller">source</a>

### get_index_status

``` python

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.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/index_tracking.py#L70"
target="_blank" style="float:right; font-size:smaller">source</a>

### get_not_indexed_pages

``` python

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.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/index_tracking.py#L78"
target="_blank" style="float:right; font-size:smaller">source</a>

### get_not_indexed_by_reason

``` python

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.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/index_tracking.py#L89"
target="_blank" style="float:right; font-size:smaller">source</a>

### fetch_sitemap_urls

``` python

def fetch_sitemap_urls(
    sitemap_url:str, # URL of the sitemap XML
)->list:

```

*Fetch all page URLs from a sitemap XML.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/index_tracking.py#L97"
target="_blank" style="float:right; font-size:smaller">source</a>

### store_all_index_status

``` python

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.*

------------------------------------------------------------------------

<a
href="https://github.com/abdelkareemkobo/seo_rat/blob/main/seo_rat/index_tracking.py#L116"
target="_blank" style="float:right; font-size:smaller">source</a>

### get_index_history

``` python

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.*
