當前位置: 首頁>>代碼示例>>Python>>正文


Python types.xhtml方法代碼示例

本文整理匯總了Python中types.xhtml方法的典型用法代碼示例。如果您正苦於以下問題:Python types.xhtml方法的具體用法?Python types.xhtml怎麽用?Python types.xhtml使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在types的用法示例。


在下文中一共展示了types.xhtml方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_content_type

# 需要導入模塊: import types [as 別名]
# 或者: from types import xhtml [as 別名]
def get_content_type(self):
        """返回這個請求使用的 ``Content-Type`` 頭.

        .. versionadded:: 3.1
        """
        mime_type, encoding = mimetypes.guess_type(self.absolute_path)
        # per RFC 6713, use the appropriate type for a gzip compressed file
        if encoding == "gzip":
            return "application/gzip"
        # As of 2015-07-21 there is no bzip2 encoding defined at
        # http://www.iana.org/assignments/media-types/media-types.xhtml
        # So for that (and any other encoding), use octet-stream.
        elif encoding is not None:
            return "application/octet-stream"
        elif mime_type is not None:
            return mime_type
        # if mime_type not detected, use application/octet-stream
        else:
            return "application/octet-stream" 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:21,代碼來源:web.py

示例2: get_content_type

# 需要導入模塊: import types [as 別名]
# 或者: from types import xhtml [as 別名]
def get_content_type(self) -> str:
        """Returns the ``Content-Type`` header to be used for this request.

        .. versionadded:: 3.1
        """
        assert self.absolute_path is not None
        mime_type, encoding = mimetypes.guess_type(self.absolute_path)
        # per RFC 6713, use the appropriate type for a gzip compressed file
        if encoding == "gzip":
            return "application/gzip"
        # As of 2015-07-21 there is no bzip2 encoding defined at
        # http://www.iana.org/assignments/media-types/media-types.xhtml
        # So for that (and any other encoding), use octet-stream.
        elif encoding is not None:
            return "application/octet-stream"
        elif mime_type is not None:
            return mime_type
        # if mime_type not detected, use application/octet-stream
        else:
            return "application/octet-stream" 
開發者ID:opendevops-cn,項目名稱:opendevops,代碼行數:22,代碼來源:web.py

示例3: get_content_type

# 需要導入模塊: import types [as 別名]
# 或者: from types import xhtml [as 別名]
def get_content_type(self):
        """Returns the ``Content-Type`` header to be used for this request.

        .. versionadded:: 3.1
        """
        mime_type, encoding = mimetypes.guess_type(self.absolute_path)
        # per RFC 6713, use the appropriate type for a gzip compressed file
        if encoding == "gzip":
            return "application/gzip"
        # As of 2015-07-21 there is no bzip2 encoding defined at
        # http://www.iana.org/assignments/media-types/media-types.xhtml
        # So for that (and any other encoding), use octet-stream.
        elif encoding is not None:
            return "application/octet-stream"
        elif mime_type is not None:
            return mime_type
        # if mime_type not detected, use application/octet-stream
        else:
            return "application/octet-stream" 
開發者ID:tp4a,項目名稱:teleport,代碼行數:21,代碼來源:web.py


注:本文中的types.xhtml方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。