|
@@ -114,58 +114,17 @@ def download_methodology(url_download: str, save_path: pathlib.Path) -> None:
|
|
|
filename = url_download.split("/")[-1]
|
|
|
download_path = save_path / filename
|
|
|
|
|
|
-
|
|
|
- if download_path.exists() and not download_path.is_symlink():
|
|
|
- print(f"Skipping download of {download_path} because it already exists.")
|
|
|
- return
|
|
|
-
|
|
|
-
|
|
|
- elif download_path.is_symlink():
|
|
|
- response = requests.get(url_download, stream=True, timeout=30)
|
|
|
- response.raise_for_status()
|
|
|
-
|
|
|
- os.remove(download_path)
|
|
|
- with open(download_path, "wb") as f:
|
|
|
- f.write(response.content)
|
|
|
-
|
|
|
- else:
|
|
|
- response = requests.get(url_download, stream=True, timeout=30)
|
|
|
- response.raise_for_status()
|
|
|
- with open(download_path, "wb") as f:
|
|
|
- f.write(response.content)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ if download_path.exists():
|
|
|
+ if download_path.is_symlink():
|
|
|
+ os.remove(download_path)
|
|
|
+ else:
|
|
|
+ print(f"Skipping download of {download_path} because it already exists.")
|
|
|
+ return
|
|
|
+
|
|
|
+ response = requests.get(url_download, stream=True, timeout=30)
|
|
|
+ response.raise_for_status()
|
|
|
+ with open(download_path, "wb") as f:
|
|
|
+ f.write(response.content)
|
|
|
|
|
|
|
|
|
def get_html_content(url: str) -> BeautifulSoup:
|
|
@@ -252,20 +211,17 @@ def download_file(url_download: str, save_path: pathlib.Path) -> bool:
|
|
|
-------
|
|
|
True if the file was downloaded, False if a cached file was found
|
|
|
"""
|
|
|
- if save_path.exists() and not save_path.is_symlink():
|
|
|
- print(f"Skipping download of {save_path}" " because it already exists.")
|
|
|
- return False
|
|
|
- elif save_path.is_symlink():
|
|
|
- with requests.get(url_download, stream=True, timeout=30) as response:
|
|
|
- response.raise_for_status()
|
|
|
- os.remove(save_path)
|
|
|
- with open(save_path, mode="wb") as file:
|
|
|
- file.write(response.content)
|
|
|
- else:
|
|
|
- with requests.get(url_download, stream=True, timeout=30) as response:
|
|
|
- response.raise_for_status()
|
|
|
- with open(save_path, mode="wb") as file:
|
|
|
- file.write(response.content)
|
|
|
+ if save_path.exists():
|
|
|
+ if not save_path.is_symlink():
|
|
|
+ print(f"Skipping download of {save_path} because it already exists.")
|
|
|
+ return False
|
|
|
+ os.remove(save_path)
|
|
|
+
|
|
|
+ with requests.get(url_download, stream=True, timeout=30) as response:
|
|
|
+ response.raise_for_status()
|
|
|
+ with open(save_path, mode="wb") as file:
|
|
|
+ file.write(response.content)
|
|
|
+
|
|
|
return True
|
|
|
|
|
|
|