ehsan-dashboards/dashboards/find_elastic_jobs.py

12 lines
496 B
Python

import requests
gitlab_pat = 'glpat-mJPdjrPiHCTj2NqNZN_m'
headers = {'PRIVATE-TOKEN': gitlab_pat}
r = requests.get('https://gitlab.ekeepa.co/api/v4/projects/10/repository/tree?recursive=true&per_page=100', headers=headers)
files = r.json()
# Let's search for elastic or sync or cron or index scripts
for f in files:
path = f['path']
if 'elastic' in path.lower() or 'sync' in path.lower() or 'cron' in path.lower() or 'job' in path.lower() or 'task' in path.lower():
print(path)