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


Python wsgi.input方法代码示例

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


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

示例1: __setitem__

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import input [as 别名]
def __setitem__(self, key, value):
        """ Change an environ value and clear all caches that depend on it. """

        if self.environ.get('bottle.request.readonly'):
            raise KeyError('The environ dictionary is read-only.')

        self.environ[key] = value
        todelete = ()

        if key == 'wsgi.input':
            todelete = ('body', 'forms', 'files', 'params', 'post', 'json')
        elif key == 'QUERY_STRING':
            todelete = ('query', 'params')
        elif key.startswith('HTTP_'):
            todelete = ('headers', 'cookies')

        for key in todelete:
            self.environ.pop('bottle.request.'+key, None) 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:20,代码来源:__init__.py

示例2: _body

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import input [as 别名]
def _body(self):
        try:
            read_func = self.environ['wsgi.input'].read
        except KeyError:
            self.environ['wsgi.input'] = BytesIO()
            return self.environ['wsgi.input']
        body_iter = self._iter_chunked if self.chunked else self._iter_body
        body, body_size, is_temp_file = BytesIO(), 0, False
        for part in body_iter(read_func, self.MEMFILE_MAX):
            body.write(part)
            body_size += len(part)
            if not is_temp_file and body_size > self.MEMFILE_MAX:
                body, tmp = TemporaryFile(mode='w+b'), body
                body.write(tmp.getvalue())
                del tmp
                is_temp_file = True
        self.environ['wsgi.input'] = body
        body.seek(0)
        return body 
开发者ID:ym2011,项目名称:POC-EXP,代码行数:21,代码来源:bottle.py

示例3: __setitem__

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import input [as 别名]
def __setitem__(self, key, value):
        """ Change an environ value and clear all caches that depend on it. """

        if self.environ.get('bottle.request.readonly'):
            raise KeyError('The environ dictionary is read-only.')

        self.environ[key] = value
        todelete = ()

        if key == 'wsgi.input':
            todelete = ('body', 'forms', 'files', 'params', 'post', 'json')
        elif key == 'QUERY_STRING':
            todelete = ('query', 'params')
        elif key.startswith('HTTP_'):
            todelete = ('headers', 'cookies')

        for key in todelete:
            self.environ.pop('bottle.request.' + key, None) 
开发者ID:ym2011,项目名称:POC-EXP,代码行数:20,代码来源:bottle.py

示例4: _body

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import input [as 别名]
def _body(self):
        """ The HTTP request body as a seekable file-like object.

            This property returns a copy of the `wsgi.input` stream and should
            be used instead of `environ['wsgi.input']`.
         """
        maxread = max(0, self.content_length)
        stream = self.environ['wsgi.input']
        body = BytesIO() if maxread < MEMFILE_MAX else TemporaryFile(mode='w+b')
        while maxread > 0:
            part = stream.read(min(maxread, MEMFILE_MAX))
            if not part: break
            body.write(part)
            maxread -= len(part)
        self.environ['wsgi.input'] = body
        body.seek(0)
        return body 
开发者ID:gabrielStanovsky,项目名称:props,代码行数:19,代码来源:bottle.py

示例5: _body

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import input [as 别名]
def _body(self):
        body_iter = self._iter_chunked if self.chunked else self._iter_body
        read_func = self.environ['wsgi.input'].read
        body, body_size, is_temp_file = BytesIO(), 0, False
        for part in body_iter(read_func, self.MEMFILE_MAX):
            body.write(part)
            body_size += len(part)
            if not is_temp_file and body_size > self.MEMFILE_MAX:
                body, tmp = TemporaryFile(mode='w+b'), body
                body.write(tmp.getvalue())
                del tmp
                is_temp_file = True
        self.environ['wsgi.input'] = body
        body.seek(0)
        return body 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:17,代码来源:__init__.py

示例6: body

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import input [as 别名]
def body(self):
        """ The HTTP request body as a seek-able file-like object. Depending on
            :attr:`MEMFILE_MAX`, this is either a temporary file or a
            :class:`io.BytesIO` instance. Accessing this property for the first
            time reads and replaces the ``wsgi.input`` environ variable.
            Subsequent accesses just do a `seek(0)` on the file object. """
        self._body.seek(0)
        return self._body 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:10,代码来源:__init__.py

示例7: _body

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import input [as 别名]
def _body(self):
        maxread = max(0, self.content_length)
        stream = self.environ['wsgi.input']
        body = BytesIO() if maxread < self.MEMFILE_MAX else TemporaryFile(mode='w+b')
        while maxread > 0:
            part = stream.read(min(maxread, self.MEMFILE_MAX))
            if not part: break
            body.write(part)
            maxread -= len(part)
        self.environ['wsgi.input'] = body
        body.seek(0)
        return body 
开发者ID:exiahuang,项目名称:SalesforceXyTools,代码行数:14,代码来源:bottle.py

示例8: body

# 需要导入模块: from gevent import wsgi [as 别名]
# 或者: from gevent.wsgi import input [as 别名]
def body(self):
        """ The HTTP request body as a seek-able file-like object. Depending on
            :attr:`MEMFILE_MAX`, this is either a temporary file or a
            :class:`io.BytesIO` instance. Accessing this property for the first
            time reads and replaces the ``wsgi.input`` environ variable.
            Subsequent accesses just do a `seek(0)` on the file object. """
        self._body.seek(0)
        return self._body

    #: An alias for :attr:`query`. 
开发者ID:exiahuang,项目名称:SalesforceXyTools,代码行数:12,代码来源:bottle.py


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