Skip to content

Commit f91431f

Browse files
committed
Use curl for hsload test files
1 parent 4804c3b commit f91431f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

h5pyd/_hl/httpconn.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,6 @@ def PUT(self, req, body=None, format="json", params=None, headers=None):
574574
headers["Content-Type"] = "application/json"
575575
data = json.dumps(body)
576576

577-
# Must be explicitly specified for Windows
578-
headers["Content-Type"] += "; charset=utf-8"
579577
self.log.info("PUT: {} format: {} [{} bytes]".format(req, format, len(data)))
580578

581579
try:

test/apps/load_files.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import sys
1616
import config
1717
import h5pyd
18-
18+
from platform import system
1919
#
2020
# Main
2121
#
@@ -60,9 +60,15 @@
6060
# wget from S3
6161
http_path = test_file_http_path + filename
6262
print("downloading:", http_path)
63-
rc = os.system(f"wget -q https://s3.amazonaws.com/hdfgroup/data/hdf5test/{filename} -P {data_dir}")
63+
64+
if system() == "Windows":
65+
get_cmd = f"curl.exe -o {filename} https://s3.amazonaws.com/hdfgroup/data/hdf5test/{filename} --create-dirs --output-dir {data_dir}"
66+
else:
67+
get_cmd = f"wget -q https://s3.amazonaws.com/hdfgroup/data/hdf5test/{filename} -P {data_dir}"
68+
69+
rc = os.system(f"{get_cmd}")
6470
if rc != 0:
65-
sys.exit("Failed to retreive test data file")
71+
sys.exit(f"Failed to retreive test data file with error code {rc}")
6672
# run hsload for each file
6773
print(f"running hsload for {hdf5_path} to {test_folder}")
6874
rc = os.system(f"python ../../h5pyd/_apps/hsload.py {hdf5_path} {test_folder}")

0 commit comments

Comments
 (0)