LZ-SG/embedded-dev-tutorials
0
1#!/usr/bin/env python32import urllib.request, json, base643TOKEN = "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"4REPO = "sg06231219-boop/embedded-dev-tutorials"5 6for path in ["app.py", "static/index.html"]:7 r = urllib.request.Request(8 f"https://api.github.com/repos/{REPO}/contents/{path}?ref=main",9 headers={"Authorization": f"token {TOKEN}", "Accept": "application/vnd.github.v3+json", "User-Agent": "push"})10 try:11 with urllib.request.urlopen(r, timeout=15) as resp:12 d = json.loads(resp.read())13 content = base64.b64decode(d["content"]).decode("utf-8")14 # Find version15 for line in content.split("\n"):16 if "v1.5" in line or "version" in line.lower()[:20]:17 print(f"{path}: {line.strip()}")18 print(f" size={d.get('size')} sha={d.get('sha','?')[:7]}")19 except Exception as e:20 print(f"FAIL {path}: {e}")21 