def view_log_stream(self, sid): path = os.path.join(get_runtime_stream_folder(), sid) try: with open(path, "r") as f: content = f.read() return content except OSError as e: print('Caught exception OSError : {0}'.format(e)) return '''<pre>Not found, please use get log button firstly.</pre>'''
def pipeline(self, sid): # len = request.headers['content-length'] new_file_path = os.path.join(get_runtime_stream_folder(), StreamView._get_pipeline_name(sid)) with open(new_file_path, 'wb') as f: data = request.stream.read() f.write(data) f.close() return jsonify(status='ok'), 200
def log(self, sid): # len = request.headers['content-length'] new_file_path = os.path.join(get_runtime_stream_folder(), sid) with open(new_file_path, 'wb') as f: data = request.stream.read() f.write(b'<pre>') f.write(data) f.write(b'</pre>') f.close() return jsonify(status='ok'), 200