diff --git a/scripts/sync-elo.py b/scripts/sync-elo.py index 694dfba..6ab4e4b 100644 --- a/scripts/sync-elo.py +++ b/scripts/sync-elo.py @@ -32,7 +32,15 @@ def main(): print(f"Downloading ELO sheet…", flush=True) resp = requests.get(DOWNLOAD_URL, timeout=120, headers={"User-Agent": "Mozilla/5.0"}) resp.raise_for_status() - print(f"Downloaded {len(resp.content):,} bytes", flush=True) + + content_type = resp.headers.get("Content-Type", "") + print(f"Downloaded {len(resp.content):,} bytes Content-Type: {content_type}", flush=True) + + # Diagnose non-Excel responses before attempting to parse + if "html" in content_type.lower() or not resp.content.startswith(b"PK"): + print("ERROR: Response is not an Excel/ZIP file. First 500 chars:", flush=True) + print(resp.content[:500].decode("utf-8", errors="replace"), flush=True) + sys.exit(1) wb = openpyxl.load_workbook(BytesIO(resp.content), read_only=True, data_only=True) ws = wb.active