grabbing a cookie
Alex Martelli
aleaxit at yahoo.com
Wed Oct 4 10:39:15 EDT 2000
"Jose Isaias Cabrera" <jicman at cinops.xerox.com> wrote in message
news:8radpp$hhc$1 at news.wrc.xerox.com...
[snip]
> reply, msg, hdrs = h.getreply()
[snip]
> for x in hdrs:
hrds is an instance of mimetools.Message, not a sequence; see
the Python Library Reference at 11.4.1 (description of the
getreply method). As 12.2.1 in the same manual explains,
you can use hdrs.headers (a sequence of lines, each with a
trailing newline) or more directly hdrs.get('Set-Cookie')
to get the content of that particular headerline.
See, e.g.:
http://starship.python.net/crew/jrush/Webbot/Cookie.py.html
for an example of a Python module handling cookies. That
one serves to *prepare* the Set-Cookie headerlines (for a
CGI script) rather than *decode* them back into values,
but it might still help. I think the encoding you want
to undo is quoted-printable, and I think there's a quopri.py
around somewhere in the Python standard libraries, too.
Alex
More information about the Python-list
mailing list