comparison Plugins/DicomWeb/DicomWeb.py @ 222:0f03ee6ffa80

DICOMweb: test_wado_hierarchy, test_wado_bulk, test_bitbucket_issue_112
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 26 Feb 2019 17:34:32 +0100
parents af8e034f4262
children 230aede7f8d5
comparison
equal deleted inserted replaced
221:7daf6a227745 222:0f03ee6ffa80
64 'Content-Type' : 'multipart/related; type=application/dicom; boundary=%s' % boundary, 64 'Content-Type' : 'multipart/related; type=application/dicom; boundary=%s' % boundary,
65 'Accept' : 'application/json', 65 'Accept' : 'application/json',
66 } 66 }
67 67
68 return DoPost(orthanc, uri, body, headers = headers) 68 return DoPost(orthanc, uri, body, headers = headers)
69
70
71 def DoGetMultipart(orthanc, uri, headers = {}):
72 answer = DoGetRaw(orthanc, uri, headers = headers)
73
74 header = ''
75 for i in answer[0]:
76 header += '%s: %s\r\n' % (i, answer[0][i])
77
78 msg = email.message_from_string(header + '\r\n' + answer[1])
79 if not msg.is_multipart():
80 raise Exception('Not a multipart message')
81
82 result = []
83
84 for part in msg.walk():
85 payload = part.get_payload(decode=True)
86 if payload != None:
87 result.append(payload)
88
89 return result