2015-05-26 06:47:00 |
Peter Levi |
description |
Some data sources allow a wider selection of wallpapers if the user is logged in.
I have tried a very fast hack to add cookies at URL fetch by adding to the Util.urllib function something like:
if url.find('wallhaven') > 0:
cookies = "name0=value0;" # put here the session cookies that identify an open session/logon
cookies += "name1=value1;"
request.add_header('Cookie', cookies )
just before the line
return urllib2.urlopen(request, data=urllib.urlencode(data) if data else None, timeout=20)
This works enough for me, but a better way could be:
- the user saves the datasource cookies with a browser to a text file after logon (plenty of addons help doing it),
- enabling cookie handling in variety with cookielib by reading from the saved cookie file
Or even better:
- enable cookie handling with cookielib
- add a Logon dialog for the specific datasource to do logon straight from variety
|
From PheniX:
Some data sources allow a wider selection of wallpapers if the user is logged in.
I have tried a very fast hack to add cookies at URL fetch by adding to the Util.urllib function something like:
if url.find('wallhaven') > 0:
cookies = "name0=value0;" # put here the session cookies that identify an open session/logon
cookies += "name1=value1;"
request.add_header('Cookie', cookies )
just before the line
return urllib2.urlopen(request, data=urllib.urlencode(data) if data else None, timeout=20)
This works enough for me, but a better way could be:
- the user saves the datasource cookies with a browser to a text file after logon (plenty of addons help doing it),
- enabling cookie handling in variety with cookielib by reading from the saved cookie file
Or even better:
- enable cookie handling with cookielib
- add a Logon dialog for the specific datasource to do logon straight from variety |
|