parse_object.py 文件源码

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

项目:rets 作者: opendoor-labs 项目源码 文件源码
def _guess_mime_type(headers: CaseInsensitiveDict) -> Optional[str]:
    location = headers.get('location')
    if location:
        mime_type, _ = mimetypes.guess_type(location)
        if mime_type:
            return mime_type

    # Parse mime type from content-type header, e.g. 'image/jpeg;charset=US-ASCII' -> 'image/jpeg'
    mime_type, _ = cgi.parse_header(headers.get('content-type', ''))
    return mime_type or None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号