I don't know about python, but in Perl you would set up an OO interface that will capture the cookies when you login, then the next time you POST or GET it will automatically spit back the proper cookies.

The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.