sjoerdk/dicomtrolley

Dicomtrolley does not handle valid http 204 - No Content

sjoerdk opened this issue · 0 comments

  • dicomtrolley version: 3.0.2
  • Python version: 3.9

Description

For queries that return no results, a DICOM-web server should return http 204 (No Content). See DICOM docs here:
https://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_8.3.4.4.html

This is not handled in dicomtrolley.
Currently this happens:

trolley.find_studies(Query(PatientName="NonExistingPatient"))
>>> dicomtrolley.exceptions.DICOMTrolleyError: Calling <server_url> failed (204 - No Content)
        response content was b''

Instead the exception should be caught and an empty list should be returned:

trolley.find_studies(Query(PatientName="NonExistingPatient"))
[]