# -*- coding: utf-8 -*-
import urllib.request, ssl, sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
ctx = ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
cands = [
    ("CAAM MS", "https://caam.rice.edu/academics/graduate-programs/master-computational-and-applied-mathematics"),
    ("CSCE MS", "https://csce.rice.edu/academics/graduate-programs/master-computational-science-and-engineering"),
    ("CEE MS", "https://cee.rice.edu/academics/graduate-programs/master-civil-and-environmental-engineering"),
    ("Digital Health", "https://digitalhealth.rice.edu/academics/masters-programs"),
    ("Energy Transition", "https://energy.rice.edu/academics/graduate-programs"),
    ("CAAM alt", "https://caam.rice.edu/graduate-programs"),
    ("CSCE alt", "https://csce.rice.edu/graduate-programs"),
    ("CEE alt", "https://cee.rice.edu/graduate-programs"),
]
for name, u in cands:
    try:
        req = urllib.request.Request(u, headers={"User-Agent":"Mozilla/5.0"})
        r = urllib.request.urlopen(req, timeout=12, context=ctx)
        b = r.read()
        print(f"{name}: {r.status} {len(b)}B  {u}")
    except Exception as e:
        print(f"{name}: FAIL {type(e).__name__} {str(e)[:80]}  {u}")
