[twill] managing sessions

David L. Erdman II linuxluser at gmail.com
Thu Dec 8 19:50:46 PST 2005


Thanks, Titus and James.

I'll try it out. It was just one of those things that I thought I'd ask
about before I started creating a program. It's not good to just assume
something will work a certain way and build all your code around that
assumtion, only to find you were wrong.

-- David Erdman II



On 12/8/05, Titus Brown <titus at caltech.edu> wrote:
>
> -> I'm doing something similar, though between runs rather than within the
> -> same execution path.  The trick is to save and restore the cookies.
> ->
> -> As a result of asking twill to go to a page, it has a cache of cookies
> -> that the page may have provided.  These may be authentication or
> session
> -> cookies, assuming the site uses them.  If the cookies are saved using
> -> twill's command for it, then they can be restored in another run (or
> -> function call) as if no time had passed.
> ->
> -> So you could either manipulate the cookies, or you could, as you
> -> suggest, instantiate the browser class (mechanize) that twill uses.
> ->
> -> I'm sure Titus could explain better.  ;-)
>
> Heck, no ;).
>
> The only thing to add is that mechanize *allows* you to handle cookies;
> twill *configures* mechanize to use cookies.  So you'd have to look at
> twill/browser.py to see how to configure mechanize properly for this
> purpose if you were going to use it directly.
>
> cheers,
> --titus
>
> _______________________________________________
> twill mailing list
> twill at lists.idyll.org
> http://lists.idyll.org/listinfo/twill
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/twill/attachments/20051208/6c4cfb62/attachment.html


More information about the twill mailing list