Your Weekly Report Script Didn't Crash. One of Its Seven Sources Just Returned Nothing.

2026-10-17来源 dev.to DevOpsEnglish

def gsc_queries(site_url: str, from_date: str, to_date: str) -> list:
service = build("searchconsole", "v1", credentials=creds)
resp = service.searchanalytics().query(siteUrl=site_url, body={
"startDate": from_date, "endDate": to_date,
"dimensions": ["query"], "rowLimit": 20}).execute()
return [{"query": r["keys"][0], "clicks": r["clicks"],
"impressions": r["impressions"]} for r in resp.get("rows", [])]

原文:https://www.a8q9.cn/en/article/your-weekly-report-script-didn-t-crash-one-of-its-seven-sources-just-returned-no-1fbcdf.html

相关文章