pbpscript is a little python toolkit for simulating a webbrowser, specifically for doing testing. It handles all the cookies and stuff for you. You might want to have a look at it. Stephen.