pCommon.py 文件源码

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

项目:crossplatform_iptvplayer 作者: j00zek 项目源码 文件源码
def clearCookie(self, cookiefile, leaveNames=[], removeNames=None, ignore_discard = True):
        try:
            toRemove = []
            if not self.useMozillaCookieJar:
                cj = cookielib.LWPCookieJar()
            else:
                cj = cookielib.MozillaCookieJar()
            cj.load(cookiefile, ignore_discard = ignore_discard)
            for cookie in cj:
                if cookie.name not in leaveNames and (None == removeNames or cookie.name in removeNames):
                    toRemove.append(cookie)
            for cookie in toRemove:
                cj.clear(cookie.domain, cookie.path, cookie.name)
            cj.save(cookiefile, ignore_discard = ignore_discard)
        except Exception:
            printExc()
            return False
        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号