mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
recorder: add upload/streaming support with put_record=stream where the content being uploaded is already in WARC record form
This commit is contained in:
parent
c8b6a48005
commit
2fb1df34c9
@ -94,6 +94,15 @@ class RecorderApp(object):
|
|||||||
def _put_record(self, request_uri, input_buff, record_type,
|
def _put_record(self, request_uri, input_buff, record_type,
|
||||||
headers, params, start_response):
|
headers, params, start_response):
|
||||||
|
|
||||||
|
if record_type == 'stream':
|
||||||
|
if self.writer.write_stream_to_file(params, input_buff):
|
||||||
|
msg = {'success': 'true'}
|
||||||
|
else:
|
||||||
|
msg = {'error_message': 'upload_error'}
|
||||||
|
|
||||||
|
return self.send_message(msg, '200 OK',
|
||||||
|
start_response)
|
||||||
|
|
||||||
req_stream = ReqWrapper(input_buff, headers)
|
req_stream = ReqWrapper(input_buff, headers)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@ -123,6 +132,13 @@ class RecorderApp(object):
|
|||||||
return params
|
return params
|
||||||
|
|
||||||
def __call__(self, environ, start_response):
|
def __call__(self, environ, start_response):
|
||||||
|
try:
|
||||||
|
return self.handle_call(environ, start_response)
|
||||||
|
except:
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
def handle_call(self, environ, start_response):
|
||||||
input_req = DirectWSGIInputRequest(environ)
|
input_req = DirectWSGIInputRequest(environ)
|
||||||
|
|
||||||
params = self._get_params(environ)
|
params = self._get_params(environ)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user