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)
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 'wallhaven' ) > 0: MozillaCookieJa r()
cj. load('~ /.config/ variety/ cookies/ wallhaven. txt') # I normally use here the full path of the file build_opener( urllib2. HTTPCookieProce ssor(cj) )
urllib2. install_ opener( opener)
if url.find(
cj = cookielib.
opener = urllib2.
to be placed in Utils just before the line Request( url) if not head_request else HeadRequest(url)
request = urllib2.
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 www.netscape. com/newsref/ std/cookie_ spec.html
# http://
# 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