comparison Plugins/DicomWeb/DicomWeb.py @ 297:f95cd3af1c7a

DICOMweb: test_transcoding
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 12 May 2020 20:58:14 +0200
parents 943166deebcb
children 79ce0f7a9714
comparison
equal deleted inserted replaced
293:032722c3e919 297:f95cd3af1c7a
66 } 66 }
67 67
68 return DoPost(orthanc, uri, body, headers = headers) 68 return DoPost(orthanc, uri, body, headers = headers)
69 69
70 70
71 def DoGetMultipart(orthanc, uri, headers = {}): 71 def DoGetMultipart(orthanc, uri, headers = {}, returnHeaders = False):
72 answer = DoGetRaw(orthanc, uri, headers = headers) 72 answer = DoGetRaw(orthanc, uri, headers = headers)
73 73
74 header = '' 74 header = ''
75 for i in answer[0]: 75 for i in answer[0]:
76 header += '%s: %s\r\n' % (i, answer[0][i]) 76 header += '%s: %s\r\n' % (i, answer[0][i])
91 result = [] 91 result = []
92 92
93 for part in msg.walk(): 93 for part in msg.walk():
94 payload = part.get_payload(decode = True) 94 payload = part.get_payload(decode = True)
95 if payload != None: 95 if payload != None:
96 result.append(payload) 96 if returnHeaders:
97 h = {}
98 for (key, value) in part.items():
99 h[key] = value
100 result.append((payload, h))
101 else:
102 result.append(payload)
97 103
98 return result 104 return result