你能通过pygithub删除一个repo吗?

can you delete a repo via pygithub?

你能用 pygithub 删除一个 repo 吗? 例如this例子,可以这样删除一个文件:

repo = g.get_repo("userName/repoName")
contents = repo.get_contents("filename.txt", ref="test")
repo.delete_file(contents.path, "remove test", contents.sha, branch="test")

是否有类似删除整个存储库的东西?如果没有,如何通过 github API?

pygithub documentation does include a delete() method, which calls the exact GitHub repo DELETE APIdelete /repos/{owner}/{repo}

所以应该可以调用该方法,如 PyGithub/PyGithub tests/Repository.py

g=Github('token')
repo = self.g.get_user().get_repo("TestPyGithub")
repo.delete()