(1)创建 repos.txt,里面写想删除的仓库(用户名/仓库名):
(2)拿个有删除权限的token /settings/tokens
(3)把下面代码里的token 换掉,然后执行这个python代码。
from time import sleepimport requestsheaders = {"Accept": "application/vnd.github.v3+json","Authorization": "token xxxxxxxxxxxxxxxxxx", # 此处的XXX代表上面的token"X-OAuth-Scopes": "repo"}with open('./repos.txt', 'r', encoding='utf-8') as f:data = f.readlines()url = "/repos/{}/{}"urls = []for line in data:name, repo = line.strip().split("/")urls.append(url.format(name, repo))for l in urls:requests.delete(url=l, headers=headers)sleep(2)
参考:
/post/6844903763996573704