---
type: "Source File"
title: "!/usr/bin/env python3"
description: "#!/usr/bin/env python3 \"\"\"READ-ONLY live HTTP probe: what status does each article class actually return?\"\"\" import os import sqlite3 import sys import urllib.request HERE = os.path.dirname(os.path.abspath(__file__))."
resource: "https://www.copecheck.com"
tags: ["copecheck", "main", "source-file", "py"]
timestamp: "2026-09-25T16:50:36Z"
site: "main"
source_path: "copecheck/http_probe.py"
---

# !/usr/bin/env python3

Source path: `copecheck/http_probe.py`  
Index snapshot generated: `2026-11-24T13:42:54Z`  
File modified: `2026-09-25T16:50:36Z`

```py
#!/usr/bin/env python3
"""READ-ONLY live HTTP probe: what status does each article class actually return?"""
import os
import sqlite3
import sys
import urllib.request

HERE = os.path.dirname(os.path.abspath(__file__))
DB = os.path.join(HERE, "data", "copecheck.db")
BASE = "http://localhost:8096"

c = sqlite3.connect(f"file:{DB}?mode=ro", uri=True)
c.row_factory = sqlite3.Row


def status(path):
    req = urllib.request.Request(BASE + path,
                                 headers={"User-Agent": "CopeCheckProbe/1.0"})
    try:
        return urllib.request.urlopen(req, timeout=20).status
    except urllib.error.HTTPError as e:
        return e.code
    except Exception as e:
        return f"ERR {e}"


CLASSES = {
    "quarantined": "SELECT slug FROM articles WHERE status='quarantined'",
    "never-analysed (no verdict)":
        "SELECT slug FROM articles WHERE status='pending' "
        "AND (verdict_md IS NULL OR trim(verdict_md)='')",
    "failed": "SELECT slug FROM articles WHERE status='failed'",
    "HEALTHY indexable": "SELECT slug FROM articles "
        "WHERE index_status='index' AND status='analysed'",
    "healthy noindex": "SELECT slug FROM articles "
        "WHERE index_status='noindex' AND status='analysed'",
}

n = int(sys.argv[1]) if len(sys.argv) > 1 else 5
for label, sql in CLASSES.items():
    rows = c.execute(sql + f" LIMIT {n}").fetchall()
    codes = []
    for r in rows:
        codes.append(status(f"/v/{r['slug']}"))
    print(f"{label:<30} n={len(rows):<3} -> {codes}")

print()
print("nonexistent slug            ->", status("/v/__definitely-not-a-real-slug"))
print("homepage                    ->", status("/"))
print("sitemap                     ->", status("/sitemap.xml"))
c.close()
```
