Skip to content

Commit 7ff92be

Browse files
committed
Fix files fetching from osf
1 parent 63c3d83 commit 7ff92be

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

phys2bids/tests/conftest.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import ssl
3-
from urllib.request import urlretrieve
3+
import requests
44

55
import pytest
66

@@ -50,7 +50,11 @@ def fetch_file(osf_id, path, filename):
5050
url = "https://osf.io/{}/download".format(osf_id)
5151
full_path = os.path.join(path, filename)
5252
if not os.path.isfile(full_path):
53-
urlretrieve(url, full_path)
53+
req = requests.get(url, allow_redirects=True)
54+
req.raise_for_status()
55+
with open(full_path, 'wb') as f:
56+
f.write(req.content)
57+
f.close()
5458
return full_path
5559

5660

0 commit comments

Comments
 (0)