mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-26 07:49:24 +01:00
(todo: add tests for non-ascii compatible encodings) improved rendering of certain pages, needs more testing lxml: remove lxml and complexity associated with having the parser, as its too unpredictable for older html, does its own decoding.
26 lines
852 B
Python
26 lines
852 B
Python
from pywb.framework.basehandlers import WbUrlHandler
|
|
from pywb.framework.wbrequestresponse import WbResponse
|
|
from pywb.framework.archivalrouter import ArchivalRouter, Route
|
|
|
|
from handlers import StaticHandler
|
|
|
|
from replay_views import RewriteLiveView
|
|
|
|
|
|
#=================================================================
|
|
class RewriteHandler(WbUrlHandler):
|
|
def __init__(self, config=dict(framed_replay=True)):
|
|
self.rewrite_view = RewriteLiveView(config)
|
|
|
|
def __call__(self, wbrequest):
|
|
return self.rewrite_view(wbrequest)
|
|
|
|
|
|
#=================================================================
|
|
def create_live_rewriter_app():
|
|
routes = [Route('rewrite', RewriteHandler()),
|
|
Route('static/default', StaticHandler('pywb/static/'))
|
|
]
|
|
|
|
return ArchivalRouter(routes, hostpaths=['http://localhost:8080'])
|