This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dlenski
Recipients dlenski, douyuan, jdetrey, jjlee, loewis, mt0321, terry.reedy
Date 2020-04-27.22:19:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1588025963.39.0.575692765418.issue2190@roundup.psfhosted.org>
In-reply-to
Content
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))
History
Date User Action Args
2020-04-27 22:19:23dlenskisetrecipients: + dlenski, loewis, terry.reedy, jjlee, douyuan, jdetrey, mt0321
2020-04-27 22:19:23dlenskisetmessageid: <1588025963.39.0.575692765418.issue2190@roundup.psfhosted.org>
2020-04-27 22:19:23dlenskilinkissue2190 messages
2020-04-27 22:19:23dlenskicreate