def _dump_session(): try: data = request.args sid = data.get('session') fname = dump_session(sid) session_manager.remove_session(sid) if fname is not None and os.path.isfile(fname): return send_from_directory(os.path.dirname(fname), os.path.basename(fname)) else: return '', 404 except Exception as ex: logger.error("Dump error {}".format(ex)) return '', 500