# -*- coding: utf-8 -*-
import io, sys, os, ssl, urllib.request, urllib.error
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE

candidates=[
 "electrical-and-computer-engineering","electrical-computer-engineering","eec","ece",
 "mechanical-and-industrial-engineering","mechanical-industrial-engineering","mie","mechanical-engineering",
 "health-informatics","health-informatics-mhi","mhi",
 "materials-science-and-engineering","materials-science-engineering","mse","materials-engineering",
 "aerospace-studies","aerospace-engineering","aerospace",
 "chemical-engineering","chemical-engineering-and-applied-chemistry",
 "physics","physics-and-astronomy","astronomy-and-astrophysics",
 "chemistry",
 "biochemistry",
 "management","master-of-management","mmanagement","mmgt",
 "mathematics","applied-mathematics","pure-mathematics",
]
base="https://www.sgs.utoronto.ca/programs/"
for slug in candidates:
    url=base+slug+"/"
    try:
        req=urllib.request.Request(url,headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0"})
        r=urllib.request.urlopen(req,timeout=15,context=ctx)
        b=r.read()
        print("OK",r.status,len(b),slug)
    except urllib.error.HTTPError as e:
        if e.code!=404: print("  ",e.code,slug)
    except Exception as e:
        print("  ERR",type(e).__name__,slug)
