ehsan-dashboards/dashboards/get_room_page.py

13 lines
479 B
Python

import requests
import urllib.parse
gitlab_pat = 'glpat-mJPdjrPiHCTj2NqNZN_m'
headers = {'PRIVATE-TOKEN': gitlab_pat}
file_path = urllib.parse.quote('src/pages/room/[...slug].tsx', safe='')
url = f'https://gitlab.ekeepa.co/api/v4/projects/3/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/room_slug_page.tsx', 'w', encoding='utf-8') as f:
f.write(r.text)