ehsan-dashboards/dashboards/inspect_frontend_routes.py

15 lines
468 B
Python

import requests
gitlab_pat = 'glpat-mJPdjrPiHCTj2NqNZN_m'
headers = {'PRIVATE-TOKEN': gitlab_pat}
def get_tree(path='', recursive=True):
url = f'https://gitlab.ekeepa.co/api/v4/projects/3/repository/tree?recursive={str(recursive).lower()}&per_page=100'
if path:
url += f'&path={path}'
r = requests.get(url, headers=headers)
return r.json()
tree = get_tree('src/pages', recursive=True)
for item in tree:
print(item['type'], item['path'])