CLI

Command-line interface for running seo_rat commands and reports.

seo_rat_sync


def seo_rat_sync(
    site_url:str, # e.g. "sc-domain:example.com"
    days:int=30, # how many days back to sync
    secrets:str='/home/runner/.config/seo_rat/client_secrets.json', token:str='./token.pickle'
):

Sync GSC data for a site


seo_rat_report


def seo_rat_report(
    website_id:int, # Website ID from the database
    days:int=90, # Days of GSC data to include
    insights:bool=False, # Include query trends and green keywords
):

Generate SEO report for a website


load_mapper


def load_mapper(
    domain:str
)->dict:

Load and run the mapper for a given domain.


seo_rat_audit


def seo_rat_audit(
    website_id:int, # Website ID from the database
    url:str='', # Page URL to audit
    file_path:str='', # Local file path to audit
    days:int=90, # Days of GSC data to include
    insights:bool=False, # Include trends and green keywords
):

Audit a single page for SEO issues


seo_rat_rank


def seo_rat_rank(
    website_id:int, # Website ID from the database
    keywords:str, # Comma-separated keywords to tracke
    range_type:str='entire_history', # Date range type
    country:str='', # Optional country code (e.g. 'sau')
):

Check keyword rankings for a website


seo_rat_top_pages


def seo_rat_top_pages(
    website_id:int, # Website ID from the database
    range_type:str='entire_history', # Date range type
    limit:int=20, # Number of pages to show
    country:str='', # Optional country code (e.g. 'sau')
):

Show top performing pages by clicks and impressions


seo_rat_wins


def seo_rat_wins(
    website_id:int, # Website ID from the database
    page_url:str='', # Optional page URL to filter
    range_type:str='entire_history', # Date range type
    min_impressions:int=100, # Minimum impressions threshold
    min_position:float=10.0, # Minimum avg position
    max_position:float=50.0, # Maximum avg position cutoff
    limit:int=20, # Number of results to show
    country:str='', # Optional country code
):

Show high-impression, low-ranking keyword wins


seo_rat_canob


def seo_rat_canob(
    website_id:int, # Website ID from the database
    keyword:str='', # Specific keyword to check (omit for full site scan)
    similarity_threshold:float=0.8, # Similarity threshold for content groups
):

Detect keyword cannibalization across pages


Indexing


fmt_date


def fmt_date(
    dt:str | None
)->str:

Format ISO datetime to YYYY-MM-DD.


seo_rat_index_refresh


def seo_rat_index_refresh(
    website_id:int, # Website ID from the database
    sitemap_url:str, # Sitemap URL to fetch and re-check
):

Refresh index status for all pages in a sitemap


seo_rat_crawl_errors


def seo_rat_crawl_errors(
    website_id:int, # Website ID from the database
):

Show pages with crawl or indexing issues


seo_rat_index_report


def seo_rat_index_report(
    website_id:int, # Website ID from the database
    sitemap_url:str='', # Sitemap URL to refresh data (optional)
):

Show index status report grouped by reason


seo_rat_index_check


def seo_rat_index_check(
    website_id:int, # Website ID from the database
    page_url:str, # Page URL to inspect
):

Check and store index status for a single page