Skip to content

Commit

Permalink
see dir contents
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaloney111 committed Jun 10, 2024
1 parent 958c103 commit d797c0a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def upload_file():

@app.route('/get-classifiers', methods=["GET"])
def get_classifiers():
print(build_tree('../../../'))
#print(build_tree('../..'))
classifiers = get_available_classifiers()
return jsonify(classifiers)

Expand All @@ -87,13 +87,19 @@ def build_tree(directory, indent=''):
"""
tree = indent + os.path.basename(directory) + '/' + '\n'
indent += ' '
for item in os.listdir(directory):
if item != 'node_modules' and item != 'dist' and item != 'venv' and item != '.git':
item_path = os.path.join(directory, item)
if os.path.isdir(item_path):
tree += build_tree(item_path, indent)
else:
tree += indent + item + '\n'
try:
for item in os.listdir(directory):
if item != 'node_modules' and item != 'dist' and item != 'venv' and item != '.git':
item_path = os.path.join(directory, item)
if os.path.isdir(item_path):
try:
tree += build_tree(item_path, indent)
except PermissionError as e:
print(f"Permission error: {e}")
else:
tree += indent + item + '\n'
except PermissionError as e:
pass
return tree

@app.get('/shutdown')
Expand Down

0 comments on commit d797c0a

Please sign in to comment.