ehsan-dashboards/dashboards/get_elastic_search_file.py

14 lines
511 B
Python

import requests
import urllib.parse
gitlab_pat = 'glpat-mJPdjrPiHCTj2NqNZN_m'
headers = {'PRIVATE-TOKEN': gitlab_pat}
fname = 'src/models/helper/search/getElasticSearch.ts'
file_path = urllib.parse.quote(fname, safe='')
url = f'https://gitlab.ekeepa.co/api/v4/projects/10/repository/files/{file_path}/raw?ref=main'
r = requests.get(url, headers=headers)
print("Status:", r.status_code)
print(r.text[:3000])
with open('/workspace/personal/getElasticSearch.ts', 'w', encoding='utf-8') as f:
f.write(r.text)