Exemplo n.º 1
0
def uploaded_file(filename):
    try:
        dirPath = os.path.abspath(app.config['UPLOAD_DIR'])
        if os.path.isfile(os.path.join(dirPath,filename)):
            return send_from_directory(dirPath,filename,as_attachment=True)
        else:
            return lib.pushText("Sorry the requested file [" + filename + "] doesn't exist.Please note that log files and output files on this server available only for 6 hours.")
    except Exception as err:
        return lib.pushText('Following error occured while processing retrieving the file ['+filename+']\n'+str(err))
Exemplo n.º 2
0
def showEnvDetails():

    toDir = app.config['UPLOAD_DIR']
    s="Now: "+str( datetime.now())
    s= s+"\nUpload Directory: "+toDir
    s= s+"\n Is Exists: " +str(os.path.exists(toDir))
    if os.path.exists(toDir):
        s= s+"\n No. of zip Files(Load): "+str(len(glob.glob1(toDir,"*.zip")))
        s= s+"\n No. of Log Files(Sessions): "+str(len(glob.glob1(toDir,"*.log")))
    
    quota=os.path.join(app.config['DATA_DIR'],"quota.txt")
    if os.path.exists(quota):
        with open(quota, 'r') as content_file:
            content = content_file.read()
            s=s+"\nQuota Details:"
            s=s+"\n"+content

    last_hourly_cron_ran=os.path.join(app.config['DATA_DIR'],"last_hourly_cron_ran")
    if os.path.exists(last_hourly_cron_ran):
        with open(last_hourly_cron_ran, 'r') as content_file:
            content = content_file.read()
            s=s+"\nLast Hourly Cron exeuted at:"
            s=s+" "+content
    
    return lib.pushText(s)