webapp2.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:webapp2 作者: GoogleCloudPlatform 项目源码 文件源码
def __init__(self, environ, *args, **kwargs):
        """Constructs a Request object from a WSGI environment.

        :param environ:
            A WSGI-compliant environment dictionary.
        """
        if kwargs.get('charset') is None and not hasattr(webob, '__version__'):
            # webob 0.9 didn't have a __version__ attribute and also defaulted
            # to None rather than UTF-8 if no charset was provided. Providing a
            # default charset is required for backwards compatibility.
            match = _charset_re.search(environ.get('CONTENT_TYPE', ''))
            if match:
                self._request_charset = (
                    match.group(1).lower().strip().strip('"').strip())

        kwargs['charset'] = 'utf-8'

        super(Request, self).__init__(environ, *args, **kwargs)
        self.registry = {}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号