Daniel Lenski <[email protected]> added the comment:
Also confused about why this was closed.
This format is still frequently used. In the absence of a solution in the
standard library, I'm using this kludge to strip the leading `#HttpOnly_`.
from tempfile import NamedTemporaryFile
from http.cookiejar import MozillaCookieJar
from contextlib import contextmanager
def fix_cookie_jar_file(orig_cookiejarfile):
with NamedTemporaryFile(mode='w+') as cjf:
with open(orig_cookiejarfile, 'r') as ocf:
for l in ocf:
cjf.write(l[10:] if l.startswith('#HttpOnly_') else l)
cjf.seek(0)
yield cjf.name
MozillaCookieJar(filename=fix_cookie_jar_file(orig_cookiejarfile))
----------
nosy: +dlenski
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue2190>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com