Mercurial > hg > orthanc
comparison Resources/Samples/Python/DownloadAnonymized.py @ 1184:4e9d517503ae
port to Python3
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 10 Oct 2014 09:13:48 +0200 |
parents | 44382c8bcd15 |
children | 6e7e5ed91c2d |
comparison
equal
deleted
inserted
replaced
1183:6ef2c81581cd | 1184:4e9d517503ae |
---|---|
40 infos = RestToolbox.DoGet('%s/patients/%s' % (URL, patient)) | 40 infos = RestToolbox.DoGet('%s/patients/%s' % (URL, patient)) |
41 name = infos['MainDicomTags']['PatientName'].lower() | 41 name = infos['MainDicomTags']['PatientName'].lower() |
42 if name.startswith('anonymized'): | 42 if name.startswith('anonymized'): |
43 | 43 |
44 # Trigger the download | 44 # Trigger the download |
45 print 'Downloading %s' % name | 45 print('Downloading %s' % name) |
46 zipContent = RestToolbox.DoGet('%s/patients/%s/archive' % (URL, patient)) | 46 zipContent = RestToolbox.DoGet('%s/patients/%s/archive' % (URL, patient)) |
47 f = open(os.path.join('/tmp', name + '.zip'), 'wb') | 47 f = open(os.path.join('/tmp', name + '.zip'), 'wb') |
48 f.write(zipContent) | 48 f.write(zipContent) |
49 f.close() | 49 f.close() |