MCPcopy
hub / github.com/scrapinghub/splash / _html_resource

Function _html_resource

splash/tests/mockserver.py:49–69  ·  view source on GitHub ↗
(html)

Source from the content-addressed store, hash-verified

47
48
49def _html_resource(html):
50
51 class HtmlResource(Resource):
52 isLeaf = True
53 template = html
54
55 def __init__(self, http_port=None, https_port=None):
56 Resource.__init__(self)
57 self.http_port = http_port
58 self.https_port = https_port
59
60 @use_chunked_encoding
61 def render(self, request):
62 response = self.template % dict(
63 http_port=self.http_port,
64 https_port=self.https_port
65 )
66 # Twisted wants response to be bytes
67 return response.encode('utf-8')
68
69 return HtmlResource
70
71
72JsRender = _html_resource("""

Callers 2

mockserver.pyFile · 0.85
IframeResourceClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected