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
评论列表
文章目录