Skip to content

Commit 67cc036

Browse files
committed
Captured post request when registering tomography preprocessing parameters; leave 'None' as-is when preparing the JSON data in '_start_dc'
1 parent 2c595ca commit 67cc036

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/murfey/client/multigrid_control.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,16 @@ def _start_dc(self, json, from_form: bool = False):
403403
# it is then necessary to extract the data from the message
404404
if from_form:
405405
json = json.get("form", {})
406-
json = {k: str(v) for k, v in json.items()}
406+
# Safely convert all entries into strings, but leave None as-is
407+
json = {k: str(v) if v is not None else None for k, v in json.items()}
407408
self._environment.data_collection_parameters = {
408409
k: None if v == "None" else v for k, v in json.items()
409410
}
410411
source = Path(json["source"])
411412
context = self.analysers[source]._context
412413
if isinstance(context, TomographyContext):
413414
if from_form:
414-
requests.post(
415+
capture_post(
415416
f"{self._environment.url.geturl()}/clients/{self._environment.client_id}/tomography_processing_parameters",
416417
json=json,
417418
)
@@ -442,7 +443,7 @@ def _start_dc(self, json, from_form: bool = False):
442443
)
443444
eer_fractionation_file = eer_response.json()["eer_fractionation_file"]
444445
json.update({"eer_fractionation_file": eer_fractionation_file})
445-
requests.post(
446+
capture_post(
446447
f"{self._environment.url.geturl()}/sessions/{self._environment.murfey_session}/tomography_preprocessing_parameters",
447448
json=json,
448449
)

0 commit comments

Comments
 (0)