From 739fdeedf3afde1ff85f015397e54b8b014fd744 Mon Sep 17 00:00:00 2001 From: hulk Date: Mon, 14 Sep 2026 15:44:04 +0800 Subject: [PATCH] =?UTF-8?q?chore(DLPilot):=20v0.3.2=20=E6=89=93=E5=8C=85(e?= =?UTF-8?q?xe=20=E5=90=AB=E6=A0=87=E9=A2=98=E6=A0=8F=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7,=20=E5=81=9C=E6=AD=A2=E6=B5=8B=E8=AF=95=E5=9B=BE?= =?UTF-8?q?=E5=83=8F=E6=9B=B4=E5=90=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _list_rels.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 _list_rels.py diff --git a/_list_rels.py b/_list_rels.py new file mode 100644 index 0000000..52b0f41 --- /dev/null +++ b/_list_rels.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +"""列出 Gitea 上全部 release(token 从注册表读取)""" +import json +import ssl +import urllib.request +import winreg + +with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Environment') as k: + tok, _ = winreg.QueryValueEx(k, 'GITEA_TOKEN') + +ctx = ssl._create_unverified_context() +req = urllib.request.Request( + 'https://gitea.hulk.wang/api/v1/repos/hulk/LT8619C_Debug_Tools/releases', + headers={'Authorization': f'token {tok}'}) +for attempt in range(4): + try: + with urllib.request.urlopen(req, context=ctx) as r: + rels = json.loads(r.read()) + break + except Exception as e: + print('retry', attempt, e) + import time + time.sleep(1.5) +else: + raise SystemExit('请求失败') + +print(f'共 {len(rels)} 个 release:') +for r in rels: + assets = r['assets'] + items = assets['items'] if isinstance(assets, dict) else assets + names = [a['name'] for a in items] + print(f" {r['tag_name']:<18} {r['name']:<16} 资产: {names}") + print(f" {r['html_url']}")