我正在尝试列出Github存储库中的所有文件。
def listFiles(self, filepath):
git = githubHandler(GH_USERNAME, GH_PASSWORD)
gh, repo, branch = git.connect_to_github()
tree = branch.commit.commit.tree.recurse()
print repo.blob
print branch
到目前为止,我只能输出repo分支和名称。 有什么想法吗?
答案 0 :(得分:0)
所以这就是我在挣扎一段时间后解决它的方法:
def list_filenames(self, filepath):
git = githubHandler(GH_USERNAME, GH_PASSWORD)
gh, repo, branch = git.connect_to_github()
tree = branch.commit.commit.tree.recurse()
for filename in tree.tree:
print("[*] Found file {0}".format(filename.path))
print filename.path
return None