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

Method __call__

splash/qtrender_lua.py:373–390  ·  view source on GitHub ↗
(self, *args)

Source from the content-addressed store, hash-verified

371 @unwraps_html_element_arguments
372 @decodes_lua_arguments('utf8')
373 def __call__(self, *args):
374 expr = "eval('('+{func_text}+')')({args})".format(
375 func_text=self.source,
376 args=escape_js_args(*args)
377 )
378 try:
379 res = self.tab.evaljs(expr)
380 except JsError as e:
381 raise ScriptError({
382 'type': ScriptError.JS_ERROR,
383 'js_error_type': e.args[0]['js_error_type'],
384 'js_error_message': e.args[0]['js_error_message'],
385 'js_error': e.args[0]['js_error'],
386 'message': "error during JS function call: "
387 "{!r}".format(e.args[0]['js_error'])
388 })
389
390 return self.splash.expose_html_elements(res)
391
392
393class BaseExposedObject(object):

Callers

nothing calls this directly

Calls 4

escape_js_argsFunction · 0.90
ScriptErrorClass · 0.90
expose_html_elementsMethod · 0.80
evaljsMethod · 0.45

Tested by

no test coverage detected