import urllib3 import shutil class orthancFileBrowser: def __init__(self,net): self.net=net def getZip(self,retrieveLevel, dataId, path): url=self.net.getCoreURL() url+="/"+retrieveLevel+"/"+dataId+"/archive"; response=self.net.get(url,binary=True); with open(path,'wb') as out_file: shutil.copyfileobj(response,out_file) response.release_conn() #response.data is a byte array -> is the same as file