# GSC Client


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

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

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

### GSCAuth

``` python

def GSCAuth(
    secrets_file:str='./client_secrets.json', # Path to OAuth client secrets
    token_file:str='./token.pickle', # Path to cached token
):

```

*Google Search Console authentication handler.*

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

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

### get_date_range

``` python

def get_date_range(
    range_type:str='today', days:int | None=None, # Number of days for `last_days`
    months:int | None=None, # Number of months for `last_months`
    start_date:str | None=None, # Start date for `custom` (YYYY-MM-DD)
    end_date:str | None=None, # End date for `custom` (YYYY-MM-DD)
)->tuple:

```

*Generate a date range for GSC queries, accounting for the 3-day data
delay.*

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

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

### fetch_gsc_data

``` python

def fetch_gsc_data(
    auth:GSCAuth, # Authenticated GSCAuth instance
    site_url:str, # GSC property URL
    start_date:str, # Start date (YYYY-MM-DD)
    end_date:str, # End date (YYYY-MM-DD)
    dimensions:list[str] | None=None, # GSC dimensions to group by
    row_limit:int=25000, # Max rows to fetch
)->list:

```

*Fetch analytics rows from Google Search Console.*

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

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

### get_verified_sites

``` python

def get_verified_sites(
    auth:GSCAuth, # Authenticated GSCAuth instance
)->list:

```

*Get all verified GSC properties for the authenticated account.*
