[issue17251] LWPCookieJar load() set domain_specifed wrong
New submission from B. Kyven: Hello, I am using LWPCookieJar to store cookies. But I am having trouble. Saving is fine, load is wrong. I use Cookie.domain_specified to judge if domain exist. save the following to test.lwp - #LWP-Cookies-2.0 Set-Cookie3: name=value; path="/ddd/"; domain=".domain.com"; path_spec; domain_dot; secure; expires="2030-05-09 14:25:11Z"; version=0 Set-Cookie3: name=value; path="/ddd/"; domain="www.domain.com"; path_spec; secure; expires="2030-05-09 14:25:11Z"; version=0 - >cj = LWPCookieJar('test.lwp').load() >for c in cj: >print c.domain, c.domain_specified, c.domain_initial_dot output: .domain.com True True www.domain.com **False** True If understood correctly, domain_specified should equal bool(c.domain =""). This is seen on 2.7 and 2.6. -- components: Library (Lib) messages: 182476 nosy: B. Kyven priority: normal severity: normal status: open title: LWPCookieJar load() set domain_specifed wrong type: behavior versions: Python 2.6, Python 2.7 ___ Python tracker <http://bugs.python.org/issue17251> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17251] LWPCookieJar load() set domain_specifed wrong
B. Kyven added the comment: I now realized LWPCookieJar is a subclass of CookieJar but it behaves differently. I believe there are other quirks I haven't discovered, like expire=None which cause exception in LWPCookieJar, but works fine for CookieJar. Sadly the doc didn't mention them. The official python document introduced 2 file cookiejar, one is Mozilla's FileCookieJar, which is explicitly advised as depricated. LWPCookieJar which is human-readable seems the only advisable chooice to me. But it turns out not that simple. My guess is that not many people use this module, or the expire=None problem and this dot question should be quite easy to spot on google. So forks, could your suggest how does other python user deal with cookie storage. Do they just pickle the cookie objects and save to file? Or any via 3rd party cookie batteries? What's their pro/cons ? LWPCookie's usage is strage to me and ,I believe, many average users, I guess many people like me will be willing to know alternatives. -- ___ Python tracker <http://bugs.python.org/issue17251> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17251] LWPCookieJar load() set domain_specifed wrong
B. Kyven added the comment: @Demian Brecht Um, I do realize the lack of popularity of this module, now. What I try to achieve is simple. store persistent cookies in a way, that's told to be standard in python ? Actually, I was trying to sync QtCookiesJar to CookieJar to make urllib2 works with cookie sessions opened in QtWebKit to skip the heavy javascript powered login process.(now it works either way not both) And I need a way to save persistent cookie. Maybe I need to rethink my strategy. Any thoughts? -- ___ Python tracker <http://bugs.python.org/issue17251> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com