Mercurial > hg > orthanc
comparison Resources/Samples/Python/DownloadAnonymized.py @ 2070:7e6afa0beaf6
samples: improved handling of special characters in paths
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 14 Jul 2016 09:05:22 +0200 |
parents | 65b1ce7cb84f |
children | a3a65de1840f |
comparison
equal
deleted
inserted
replaced
2069:fabf7820d1f1 | 2070:7e6afa0beaf6 |
---|---|
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 with open(os.path.join('/tmp', name + '.zip'), 'wb') as f: |
48 f.write(zipContent) | 48 f.write(zipContent) |
49 f.close() |