Ich baue derzeit Kirsche py App für meine Projekte und bei bestimmten Funktionen brauche ich automatisch starten eine Datei herunterladen.Kirsche py Auto-Download-Datei
Nach Zip-Datei Finish Erzeugungs möchte ich Download auf Client starten So, nachdem Bilder erstellt werden, sind sie mit Reißverschluss und an den Client gesendet
class Process(object):
exposed = True
def GET(self, id, norm_all=True, format_ramp=None):
...
def content(): #generating images
...
def zipdir(basedir, archivename):
assert os.path.isdir(basedir)
with closing(ZipFile(archivename, "w", ZIP_DEFLATED)) as z:
for root, dirs, files in os.walk(basedir):
#NOTE: ignore empty directories
for fn in files:
absfn = os.path.join(root, fn)
zfn = absfn[len(basedir)+len(os.sep):] #XXX: relative path
z.write(absfn, zfn)
zipdir("/data/images/8","8.zip")
#after zip file finish generating, I want to start downloading to client
#so after images are created, they are zipped and sent to client
#and I'm thinking do it here, but don't know how
return content()
GET._cp_config = {'response.stream': True}
def POST(self):
global proc
global processing
proc.kill()
processing = False