made get repo contents method work recursively

This commit is contained in:
kenna-bmcdevitt 2024-08-26 16:45:17 -05:00
parent abcaf1177b
commit fc664d5ad3

View file

@ -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}")