changeset 5531:2bce8d26db5e

added login/pwd to ArchiveStudiesInTimeRange.py
author Alain Mazy <am@osimis.io>
date Fri, 09 Feb 2024 09:03:46 +0100
parents acdb8d78bf99
children 509c741f6ac0
files OrthancServer/Resources/Samples/Python/ArchiveStudiesInTimeRange.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Resources/Samples/Python/ArchiveStudiesInTimeRange.py	Tue Feb 06 15:32:54 2024 +0100
+++ b/OrthancServer/Resources/Samples/Python/ArchiveStudiesInTimeRange.py	Fri Feb 09 09:03:46 2024 +0100
@@ -30,8 +30,8 @@
 def PrintHelp():
     print('Download ZIP archives for all the studies generated '
           'during a given time range (according to the StudyDate tag)\n')
-    print('Usage: %s <URL> <StartDate> <EndDate> <TargetFolder>\n' % sys.argv[0])
-    print('Example: %s http://127.0.0.1:8042/ 20150101 20151231 /tmp/\n' % sys.argv[0])
+    print('Usage: %s <URL> <StartDate> <EndDate> <TargetFolder> [login] [password]\n' % sys.argv[0])
+    print('Example: %s http://127.0.0.1:8042/ 20150101 20151231 /tmp/ login password\n' % sys.argv[0])
     exit(-1)
 
 def CheckIsDate(date):
@@ -40,13 +40,15 @@
         exit(-1)
 
 
-if len(sys.argv) != 5:
+if len(sys.argv) < 5:
     PrintHelp()
 
 URL = sys.argv[1]
 START = sys.argv[2]
 END = sys.argv[3]
 TARGET = sys.argv[4]
+if len(sys.argv) >= 7:
+    RestToolbox.SetCredentials(sys.argv[5], sys.argv[6])
 
 CheckIsDate(START)
 CheckIsDate(END)