Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,8 @@ load_dotenv()
|
|
23 |
with open('config.json') as config_file:
|
24 |
config = json.load(config_file)
|
25 |
|
|
|
|
|
26 |
|
27 |
PERSIST_DOC_DIRECTORY = config["persist_doc_directory"]
|
28 |
PERSIST_CODE_DIRECTORY =config["persist_code_directory"]
|
@@ -52,13 +54,11 @@ def load_project_id(json_file):
|
|
52 |
def download_gitlab_project_by_version():
|
53 |
try:
|
54 |
# Load the configuration from config.json
|
55 |
-
with open("config2.json", "r") as file:
|
56 |
-
config = json.load(file)
|
57 |
|
58 |
# Extract GitLab project information from the config
|
59 |
-
api_url =
|
60 |
-
project_id = urllib.parse.quote(
|
61 |
-
version =
|
62 |
|
63 |
# Construct the URL for the release's zip file
|
64 |
url = f"{api_url}/projects/{project_id}/repository/archive.zip?sha={version}"
|
@@ -75,8 +75,10 @@ def download_gitlab_project_by_version():
|
|
75 |
if content_disposition and "filename=" in content_disposition:
|
76 |
filename = content_disposition.split("filename=")[-1].strip('"')
|
77 |
print(filename)
|
78 |
-
|
79 |
-
|
|
|
|
|
80 |
|
81 |
# Check if the request was successful
|
82 |
if response.status_code == 200:
|
|
|
23 |
with open('config.json') as config_file:
|
24 |
config = json.load(config_file)
|
25 |
|
26 |
+
with open("config2.json", "r") as file:
|
27 |
+
config2 = json.load(file)
|
28 |
|
29 |
PERSIST_DOC_DIRECTORY = config["persist_doc_directory"]
|
30 |
PERSIST_CODE_DIRECTORY =config["persist_code_directory"]
|
|
|
54 |
def download_gitlab_project_by_version():
|
55 |
try:
|
56 |
# Load the configuration from config.json
|
|
|
|
|
57 |
|
58 |
# Extract GitLab project information from the config
|
59 |
+
api_url = config2['gitlab']['api_url']
|
60 |
+
project_id = urllib.parse.quote(config2['gitlab']['project']['id'], safe="")
|
61 |
+
version = config2['gitlab']['project']['version']
|
62 |
|
63 |
# Construct the URL for the release's zip file
|
64 |
url = f"{api_url}/projects/{project_id}/repository/archive.zip?sha={version}"
|
|
|
75 |
if content_disposition and "filename=" in content_disposition:
|
76 |
filename = content_disposition.split("filename=")[-1].strip('"')
|
77 |
print(filename)
|
78 |
+
|
79 |
+
|
80 |
+
# test
|
81 |
+
# target_path = f"{DATA_DIR}/{filename}"
|
82 |
|
83 |
# Check if the request was successful
|
84 |
if response.status_code == 200:
|