chore: 移除临时诊断脚本
This commit is contained in:
@@ -1,33 +0,0 @@
|
|||||||
# -*- 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']}")
|
|
||||||
Reference in New Issue
Block a user