image_manager.py 文件源码

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

项目:MarkdownLivePreview 作者: math2001 项目源码 文件源码
def get_base64_saver(loading, url):
    def callback(content):
        if isinstance(content, urllib.error.HTTPError):
            if content.getcode() == 404:
                loading[url] = 404
                return
        elif isinstance(content, urllib.error.URLError):
            if (content.reason.errno == 11001 and
                content.reason.strerror == 'getaddrinfo failed'):
                loading[url] = 404
                return
            return sublime.error_message('An unexpected error has occured: ' +
                                         str(content))
        loading[url] = to_base64(content=content)

    return callback
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号