from urllib.request import Request, urlopen
import csv
import hashlib
import io
import json

# Pin a release so re-running the notebook reads the same data.
base = "https://www.fiveletterwords.io/data/releases/v2026-09-01/"
with urlopen(
    Request(base + "manifest.json", headers={"User-Agent": "FiveLetterWordsResearchExample/1.0"}),
    timeout=30,
) as response:
    manifest = json.load(response)
filename = "answer-repeats.csv"
with urlopen(
    Request(base + filename, headers={"User-Agent": "FiveLetterWordsResearchExample/1.0"}),
    timeout=30,
) as response:
    raw = response.read()
assert hashlib.sha256(raw).hexdigest() == manifest["files"][filename]["sha256"]
rows = list(csv.DictReader(io.StringIO(raw.decode("utf-8"))))
print("FiveLetterWords", manifest["release"], "through", manifest["answer_history_data_through"])
rows[:10]
