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):
|
def get_repo_contents(self, repo):
|
||||||
try:
|
try:
|
||||||
contents = repo.get_contents("")
|
contents = repo.get_contents("")
|
||||||
for content_file in contents:
|
while contents:
|
||||||
print(content_file)
|
file_content = contents.pop(0)
|
||||||
|
if file_content.type == "dir":
|
||||||
|
contents.extend(repo.get_contents(file_content.path))
|
||||||
|
else:
|
||||||
|
print(file_content)
|
||||||
return contents
|
return contents
|
||||||
except GithubException as e:
|
except GithubException as e:
|
||||||
logging.error(f"Error getting repository contents: {e}")
|
logging.error(f"Error getting repository contents: {e}")
|
||||||
|
|
Loading…
Add table
Reference in a new issue