Comment 3 for bug 1458759

Revision history for this message
PheniX (a-sterbini) wrote :

Hi Peter
I have done some doc search and it seems that something like the following lines should do the trick

       # To enable sessions only in wallhaven
        if url.find('wallhaven') > 0:
            cj = cookielib.MozillaCookieJar()
            cj.load('~/.config/variety/cookies/wallhaven.txt') # I normally use here the full path of the file
            opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
            urllib2.install_opener(opener)

to be placed in Utils just before the line
        request = urllib2.Request(url) if not head_request else HeadRequest(url)

Yet, the cookie file saved (for example) by Firebug (which is really nice because it exports only the cookies of the selected website)
requires some massaging to be loaded:
- first add the lines (the first one is the really important one)

# Netscape HTTP Cookie File
# http://www.netscape.com/newsref/std/cookie_spec.html
# This is a generated file! Do not edit.

- then you must add to each cookie line (if the expiration field is missing) a tab just before the cookie name field

... I must test all this some more ... sometime the server complains with a 400 code ...

Ciao
A