[Tutor] I sure do love cookies.
Liam Clarke
cyresse at gmail.com
Wed Jul 6 06:41:55 CEST 2005
Denise -
Create a cookie, save it, load it as a cookie jar (using cookielib), create
an URLopener using urllib2 that uses the cookiejar, do your thing. Remember
that sending a cookie/receiving a cookie client side is initiated by the
server, so you just have to have the cookie present.
The technical steps you'll have to puzzle out by reading docs for the two
above mentioned libraries, but it shouldn't take you too long with the
interactive prompt and an open web-browser to get the hang of it.
Good luck.
On 7/6/05, Kent Johnson <kent37 at tds.net> wrote:
>
> D. Hartley wrote:
> > Thank you for the code, everyone.
> >
> > I actually have a piece of information (something like
> > "this+is+a+cookie") that I am trying to *send* (not receive), and I'm
> > not sure how to do it. I looked at the Cookie examples a little bit,
> > but am having trouble applying what I see there to my present
> > situation, since there is so much that either a). doesnt apply or b).
> > is over my head (usually c). all of the above!). Although the
> > client-side illustration you provided was very clear and I'll archive
> > that for future use, too.
>
> Did you see the hint I posted a few days ago? I'll repeat it, if you want
> more detail then ask but after all it's supposed to be a challenge :-)
>
> What I did was,
> - create a new cookielib.Cookie
> - add the cookie to the CookieJar
> - make a request the same way as when I was collecting cookies
>
> To create the new Cookie it might help to look at the source for cookielib
> (Lib\cookielib.py), the Cookie constructor doesn't seem to be documented
> anywhere.
>
> To figure out the values for the Cookie constructor it might help to look
> at one of the cookies you already have.
>
> I could be wrong but I don't think Cookie.SimpleCookie is going to get you
> there.
>
> Kent
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
'There is only one basic human right, and that is to do as you damn well
please.
And with it comes the only basic human duty, to take the consequences.'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050706/bf9651f6/attachment.htm
More information about the Tutor
mailing list