bupa1018 commited on
Commit
fa8d129
·
1 Parent(s): 4a8e6b0

Update download_repo.py

Browse files
Files changed (1) hide show
  1. download_repo.py +7 -7
download_repo.py CHANGED
@@ -12,7 +12,10 @@ def download_gitlab_repo_to_hfspace(api_url, project_id, version, target_folder)
12
 
13
  # Send GET request to download the zip file
14
  # response = requests.get(url, stream=True)
15
- response = requests.get(archive_url)
 
 
 
16
  content_disposition = response.headers.get('content-disposition')
17
  if content_disposition:
18
  filename = content_disposition.split('filename=')[-1].strip('\"')
@@ -27,12 +30,9 @@ def download_gitlab_repo_to_hfspace(api_url, project_id, version, target_folder)
27
 
28
  if target_path in existing_files:
29
  print(f"File '{target_path}' already exists in the repository. Skipping upload...")
30
-
31
- if response.status_code == 200:
32
- _upload_file_to_hfspace(response, api, target_folder, HF_SPACE_NAME)
33
- else:
34
- print(f"Failed to download the release: {response.status_code} - {response.reason}")
35
- print(response.text)
36
 
37
  except FileNotFoundError:
38
  print("The config.json file was not found. Please ensure it exists in the project directory.")
 
12
 
13
  # Send GET request to download the zip file
14
  # response = requests.get(url, stream=True)
15
+ response = requests.get(url)
16
+ if response.status_code == 200:
17
+
18
+
19
  content_disposition = response.headers.get('content-disposition')
20
  if content_disposition:
21
  filename = content_disposition.split('filename=')[-1].strip('\"')
 
30
 
31
  if target_path in existing_files:
32
  print(f"File '{target_path}' already exists in the repository. Skipping upload...")
33
+ else:
34
+ _upload_file_to_hfspace(response, api, target_folder, HF_SPACE_NAME)
35
+
 
 
 
36
 
37
  except FileNotFoundError:
38
  print("The config.json file was not found. Please ensure it exists in the project directory.")