Skip to content

Commit 112bede

Browse files
database/opxrd: Added working download mechanism for newer versino
1 parent 2d01f61 commit 112bede

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

opxrd/database/opxrd.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ def load(cls, root_dirpath : str, download : bool = True, *args, **kwargs) -> Pa
2424

2525
@staticmethod
2626
def _download_zenodo_opxrd(output_fpath : str):
27-
zenodo_url = f'https://zenodo.org/api/records/14278656'
28-
file_url = f'{zenodo_url}/files/opXRD.zip/content'
29-
file_response = requests.get(url=file_url, stream=True)
27+
zenodo_url = f'https://zenodo.org/records/14278656'
28+
file_url = f'{zenodo_url}/files/opXRD.zip?download=1'
29+
file_response = requests.get(url=file_url)
30+
31+
file_response = requests.get(url=f'https://zenodo.org/records/14278656/files/opxrd.zip?download=1', stream=True)
3032

3133
total_size = int(file_response.headers.get('content-length', 0))
3234
total_chunks = (total_size // 1024) + (1 if total_size % 1024 else 0)
@@ -44,6 +46,7 @@ def _download_zenodo_opxrd(output_fpath : str):
4446

4547
@staticmethod
4648
def _unzip_file(zip_fpath : str, output_dir : str):
49+
print(f'- Unziping downloaded files to {output_dir}')
4750
with zipfile.ZipFile(zip_fpath, 'r') as zip_ref:
4851
zip_ref.extractall(output_dir)
4952
return f"Files extracted to {output_dir}"

0 commit comments

Comments
 (0)