• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python render_options.RenderOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中splash.render_options.RenderOptions的典型用法代码示例。如果您正苦于以下问题:Python RenderOptions类的具体用法?Python RenderOptions怎么用?Python RenderOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了RenderOptions类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _validate_params

 def _validate_params(self, request):
     options = RenderOptions.fromrequest(request, self.max_timeout)
     options.get_filters(self.pool)  # check
     params = options.get_common_params(self.pool.js_profiles_path)
     params.update({"timeout": options.get_timeout(), "har": 1, "png": 1, "html": 1})
     if self.lua_enabled:
         params.update({"lua_source": options.get_lua_source()})
     return params
开发者ID:SimonWan,项目名称:splash,代码行数:8,代码来源:resources.py


示例2: _validate_params

 def _validate_params(self, request):
     options = RenderOptions.fromrequest(request, self.max_timeout)
     options.get_filters(self.pool)  # check
     params = options.get_common_params(self.pool.js_profiles_path)
     params.update({
         'timeout': options.get_timeout(),
         'har': 1,
         'png': 1,
         'html': 1,
     })
     if self.lua_enabled:
         params.update({
             'lua_source': options.get_lua_source(),
         })
     return params
开发者ID:Cloverseer,项目名称:splash,代码行数:15,代码来源:resources.py


示例3: render_GET

    def render_GET(self, request):
        #log.msg("%s %s %s %s" % (id(request), request.method, request.path, request.args))

        request.starttime = time.time()
        render_options = RenderOptions.fromrequest(request)
        render_options.get_filters(self.pool)  # check filters earlier

        pool_d = self._getRender(request, render_options)

        timeout = render_options.get_timeout()
        wait_time = render_options.get_wait()

        timer = reactor.callLater(timeout+wait_time, pool_d.cancel)
        pool_d.addCallback(self._cancelTimer, timer)
        pool_d.addCallback(self._writeOutput, request)
        pool_d.addErrback(self._timeoutError, request)
        pool_d.addErrback(self._renderError, request)
        pool_d.addErrback(self._badRequest, request)
        pool_d.addErrback(self._internalError, request)
        pool_d.addBoth(self._finishRequest, request)
        return NOT_DONE_YET
开发者ID:shirk3y,项目名称:splash,代码行数:21,代码来源:resources.py


示例4: _validate_params

    def _validate_params(self, request):
        options = RenderOptions.fromrequest(request, self.max_timeout)
        options.get_filters(self.pool)  # check
        params = options.get_common_params(self.pool.js_profiles_path)
        params.update({
            'save_args': options.get_save_args(),
            'load_args': options.get_load_args(),
            'timeout': options.get_timeout(),
            'har': 1,
            'png': 1,
            'html': 1,
        })
        filters = options.get('filters', default='')
        if filters:
            params['filters'] = filters

        if self.lua_enabled:
            params.update({
                'lua_source': options.get_lua_source(),
            })
        return params
开发者ID:Ragib95,项目名称:splash,代码行数:21,代码来源:resources.py


示例5: render_GET

    def render_GET(self, request):
        #log.msg("%s %s %s %s" % (id(request), request.method, request.path, request.args))
        request.starttime = time.time()
        render_options = RenderOptions.fromrequest(request, self.max_timeout)

        # process argument cache
        original_options = render_options.data.copy()
        expired_args = render_options.get_expired_args(self.argument_cache)
        if expired_args:
            error = self._write_expired_args(request, expired_args)
            self._log_stats(request, original_options, error)
            return b"\n"

        saved_args = render_options.save_args_to_cache(self.argument_cache)
        if saved_args:
            value = ';'.join("{}={}".format(name, value)
                             for name, value in saved_args)
            request.setHeader(b'X-Splash-Saved-Arguments', value.encode('utf8'))
        render_options.load_cached_args(self.argument_cache)

        # check arguments before starting the render
        render_options.get_filters(self.pool)

        timeout = render_options.get_timeout()
        wait_time = render_options.get_wait()

        pool_d = self._get_render(request, render_options)
        timer = reactor.callLater(timeout+wait_time, pool_d.cancel)
        request.notifyFinish().addErrback(self._request_failed, pool_d, timer)

        pool_d.addCallback(self._cancel_timer, timer)
        pool_d.addCallback(self._write_output, request)
        pool_d.addErrback(self._on_timeout_error, request, timeout=timeout)
        pool_d.addErrback(self._on_render_error, request)
        pool_d.addErrback(self._on_bad_request, request)
        pool_d.addErrback(self._on_internal_error, request)
        pool_d.addBoth(self._finish_request, request,
                       options=original_options)
        return NOT_DONE_YET
开发者ID:ii0,项目名称:splash,代码行数:39,代码来源:resources.py


示例6: render_GET

    def render_GET(self, request):
        #log.msg("%s %s %s %s" % (id(request), request.method, request.path, request.args))

        request.starttime = time.time()
        render_options = RenderOptions.fromrequest(request, self.max_timeout)

        # check arguments before starting the render
        render_options.get_filters(self.pool)

        timeout = render_options.get_timeout()
        wait_time = render_options.get_wait()

        pool_d = self._get_render(request, render_options)
        timer = reactor.callLater(timeout+wait_time, pool_d.cancel)
        pool_d.addCallback(self._cancel_timer, timer)
        pool_d.addCallback(self._write_output, request, options=render_options.data)
        pool_d.addErrback(self._on_timeout_error, request, timeout=timeout)
        pool_d.addErrback(self._on_render_error, request)
        pool_d.addErrback(self._on_bad_request, request)
        pool_d.addErrback(self._on_internal_error, request)
        pool_d.addBoth(self._finish_request, request)
        return NOT_DONE_YET
开发者ID:vu3jej,项目名称:splash,代码行数:22,代码来源:resources.py


示例7: _raise_proxy_error

def _raise_proxy_error(description, **kwargs):
    RenderOptions.raise_error("proxy", description, **kwargs)
开发者ID:oldtimestj,项目名称:splash,代码行数:2,代码来源:proxy.py



注:本文中的splash.render_options.RenderOptions类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.to_bytes函数代码示例发布时间:2022-05-27
下一篇:
Python utils.login函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap