webkit:是否有可能存储cookie文件并重新使用它? [英] webkit: is it possible to store cookies to file and reuse it again?

查看:195
本文介绍了webkit:是否有可能存储cookie文件并重新使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在您使用webkit并在下一次运行我的应用程序时再次使用它时将cookie存储到文件中? 我知道它的老问题,并一直在寻找答案。最后在经过一些试验和错误之后自行发布。希望这有助于其他人。

  from gi.repository import Soup 
cookiejar = Soup.CookieJarText.new(<您的Cookie路径>,False)
cookiejar.set_accept_policy(Soup.CookieJarAcceptPolicy.ALWAYS)
session = WebKit.get_default_session()
session.add_feature(cookiejar)


is it possible to store cookies to file when you use webkit and reuse it again next time when I run my application?

解决方案

I know its old question and have been looking for the answer all over the place. Finally came up on my own after some trial and error. Hope this helps others.

from gi.repository import Soup
cookiejar = Soup.CookieJarText.new("<Your cookie path>", False)
cookiejar.set_accept_policy(Soup.CookieJarAcceptPolicy.ALWAYS)
session = WebKit.get_default_session()
session.add_feature(cookiejar)

这篇关于webkit:是否有可能存储cookie文件并重新使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆