made get repo contents method work recursively
This commit is contained in:
parent
abcaf1177b
commit
fc664d5ad3
1 changed files with 6 additions and 2 deletions
|
@ -55,8 +55,12 @@ class GithubSearcher():
|
|||
def get_repo_contents(self, repo):
|
||||
try:
|
||||
contents = repo.get_contents("")
|
||||
for content_file in contents:
|
||||
print(content_file)
|
||||
while contents:
|
||||
file_content = contents.pop(0)
|
||||
if file_content.type == "dir":
|
||||
contents.extend(repo.get_contents(file_content.path))
|
||||
else:
|
||||
print(file_content)
|
||||
return contents
|
||||
except GithubException as e:
|
||||
logging.error(f"Error getting repository contents: {e}")
|
||||
|
|
Loading…
Add table
Reference in a new issue