I am trying to list all files from a Github repository.
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
So far I can only output the repo branch and name. Any ideas?
So this is how I solved it after struggling for a while:
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.