RFE: enable cookies for data sources

Asked by 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

Question information

Language:
English Edit question
Status:
Answered
For:
Variety Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Peter Levi (peterlevi) said :
#2

PheniX, please take a look at the created bugreport. I'll put my comments in there.

Can you help with this problem?

Provide an answer of your own, or ask PheniX for more information if necessary.

To post a message you must log in.