def GET(self): get_params = web.input() print str(datetime.now())+' - requested url: '+get_params['url'] sys.stdout.flush() filename = urltoimg(get_params['url']) print str(datetime.now())+' - filename retrieved: '+filename sys.stdout.flush() web.header("Content-Type", "images/png") if 'attachment' in get_params and get_params['attachment'].lower() == 'true': web.header('Content-Disposition', 'attachment; filename='+filename) return open('static'+'/'+filename,"rb").read() elif 'base64' in get_params and get_params['base64'].lower() == 'true': getFile = file( 'static'+'/'+filename, 'rb' ) web.header('Content-type','application/octet-stream') web.header('Content-transfer-encoding','base64') base64data = base64.standard_b64encode(getFile.read()) return base64data raise web.seeother('static'+'/'+filename)
def GET(self): get_params = web.input() print str(datetime.now()) + ' - requested url: ' + get_params['url'] sys.stdout.flush() filename = urltoimg(get_params['url']) print str(datetime.now()) + ' - filename retrieved: ' + filename sys.stdout.flush() web.header("Content-Type", "images/png") if 'attachment' in get_params and get_params['attachment'].lower( ) == 'true': web.header('Content-Disposition', 'attachment; filename=' + filename) return open('static' + '/' + filename, "rb").read() elif 'base64' in get_params and get_params['base64'].lower() == 'true': getFile = file('static' + '/' + filename, 'rb') web.header('Content-type', 'application/octet-stream') web.header('Content-transfer-encoding', 'base64') base64data = base64.standard_b64encode(getFile.read()) return base64data raise web.seeother('static' + '/' + filename)
def GET(self): data_input = web.input() screenshot(data_input['url'], driver) web.header("Content-Type", "images/png") # Set the Header return open('screen.png',"rb").read() # Notice 'rb' for reading images
def GET(self): data_input = web.input() screenshot(data_input['url'], driver) web.header("Content-Type", "images/png") # Set the Header return open('screen.png', "rb").read() # Notice 'rb' for reading images