ehsan-dashboards/dashboards/get_apis.py

17 lines
516 B
Python

import requests
import urllib.parse
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/apis', recursive=True)
for item in tree:
if 'room' in item['path'].lower():
print(item['path'])