common.py 文件源码

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

项目:cli 作者: sparkl 项目源码 文件源码
def unpickle_cookies(args, alias=None):
    """
    Unpickles the cookies file for the given alias and
    returns the original object.

    If no file exists, then an empty cookies object is
    returned.
    """
    if alias is None:
        alias = args.alias

    cookie_file = os.path.join(
        get_working_dir(args),
        alias + ".cookies")

    try:
        with open(cookie_file, "rb") as cookie_jar:
            cookies = pickle.load(cookie_jar)

    except BaseException:
        cookies = requests.cookies.RequestsCookieJar()
    return cookies
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号