Skip to content

Commit d61bc43

Browse files
committed
rename fields, create parent directories
1 parent ca4b9d6 commit d61bc43

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/bma_client_lib/bma_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def _upload_job_result(
297297
size = buf.getbuffer().nbytes
298298
logger.debug(f"Uploading {size} bytes result for job {job.job_uuid} with filename {filename}")
299299
start = time.time()
300-
files = {"f": (filename, buf)}
300+
files = {"data": (filename, buf)}
301301
data = {"client": json.dumps(self.clientinfo)}
302302
if isinstance(job, ThumbnailJob | ThumbnailSourceJob | ImageConversionJob):
303303
# Image generating jobs needs a metadata object as well
@@ -398,7 +398,7 @@ def upload_file(self, path: Path, attribution: str, file_license: str) -> dict[s
398398

399399
# open file
400400
with path.open("rb") as fh:
401-
files = {"f": (path.name, fh)}
401+
files = {"file_data": (path.name, fh)}
402402
# build metadata
403403
data = {
404404
"attribution": attribution,
@@ -415,14 +415,14 @@ def upload_file(self, path: Path, attribution: str, file_license: str) -> dict[s
415415
# doit
416416
r = self.client.post(
417417
self.base_url + "/api/v1/json/files/upload/",
418-
data={"f_metadata": json.dumps(data), "client": json.dumps(self.clientinfo)},
418+
data={"file_metadata": json.dumps(data), "client": json.dumps(self.clientinfo)},
419419
files=files,
420420
timeout=30,
421421
)
422422
# create symlink to file in workdir
423423
workpath = self.path / r.json()["bma_response"]["links"]["downloads"]["original"][1:]
424424
if not workpath.exists():
425-
workpath.parent.mkdir(exist_ok=True)
425+
workpath.parent.mkdir(parents=True, exist_ok=True)
426426
workpath.symlink_to(path)
427427

428428
return r.json() # type: ignore[no-any-return]

0 commit comments

Comments
 (0)