当前位置: 首页>>代码示例>>Python>>正文


Python Client.open方法代码示例

本文整理汇总了Python中werkzeug.Client.open方法的典型用法代码示例。如果您正苦于以下问题:Python Client.open方法的具体用法?Python Client.open怎么用?Python Client.open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在werkzeug.Client的用法示例。


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

示例1: open

# 需要导入模块: from werkzeug import Client [as 别名]
# 或者: from werkzeug.Client import open [as 别名]
    def open(self, *args, **kwargs):
        if self.context_preserved:
            _request_ctx_stack.pop()
            self.context_preserved = False
        kwargs.setdefault('environ_overrides', {}) \
            ['flask._preserve_context'] = self.preserve_context

        as_tuple = kwargs.pop('as_tuple', False)
        buffered = kwargs.pop('buffered', False)
        follow_redirects = kwargs.pop('follow_redirects', False)

        builder = EnvironBuilder(*args, **kwargs)

        if self.application.config.get('SERVER_NAME'):
            server_name = self.application.config.get('SERVER_NAME')
            if ':' not in server_name:
                http_host, http_port = server_name, None
            else:
                http_host, http_port = server_name.split(':', 1)
            if builder.base_url == 'http://localhost/':
                # Default Generated Base URL
                if http_port != None:
                    builder.host = http_host + ':' + http_port
                else:
                    builder.host = http_host
        old = _request_ctx_stack.top
        try:
            return Client.open(self, builder,
                               as_tuple=as_tuple,
                               buffered=buffered,
                               follow_redirects=follow_redirects)
        finally:
            self.context_preserved = _request_ctx_stack.top is not old
开发者ID:EkkiD,项目名称:balrog,代码行数:35,代码来源:testing.py

示例2: open

# 需要导入模块: from werkzeug import Client [as 别名]
# 或者: from werkzeug.Client import open [as 别名]
 def open(self, *args, **kwargs):
     if self.context_preserved:
         _request_ctx_stack.pop()
         self.context_preserved = False
     kwargs.setdefault('environ_overrides', {}) \
         ['flask._preserve_context'] = self.preserve_context
     old = _request_ctx_stack.top
     try:
         return Client.open(self, *args, **kwargs)
     finally:
         self.context_preserved = _request_ctx_stack.top is not old
开发者ID:1ncnspcuous,项目名称:WebPutty,代码行数:13,代码来源:testing.py


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