orthancFileBrowser.py 481 B

123456789101112131415161718
  1. import urllib3
  2. import shutil
  3. class orthancFileBrowser:
  4. def __init__(self,net):
  5. self.net=net
  6. def getZip(self,retrieveLevel, dataId, path):
  7. url=self.net.getCoreURL()
  8. url+="/"+retrieveLevel+"/"+dataId+"/archive";
  9. response=self.net.get(url,binary=True);
  10. with open(path,'wb') as out_file:
  11. shutil.copyfileobj(response,out_file)
  12. response.release_conn()
  13. #response.data is a byte array -> is the same as file