problems with module Cookie

Manlio Perillo NOmanlio_perilloSPAM at libero.it
Sun May 30 12:25:49 EDT 2004


On 29 May 2004 12:26:59 +0100, jjl at pobox.com (John J. Lee) wrote:

>Manlio Perillo <NOmanlio_perilloSPAM at libero.it> writes:
>
>> On 27 May 2004 22:52:10 +0100, jjl at pobox.com (John J. Lee) wrote:
>[...]
>> >You can just say:
>> >
>> >ClientCookie.urlopen("http://www.example.com/")
>> >
>> >and be done with it.
>> >
>> 
>> I have seen the module, but it is too complicated.
>
>Having written it, I agree, but I don't think it's my fault <wink>.
>

Well, it is too complicated for me.

>
>> Standard Cookie module (with my corrections) plus httplib module is
>> really all I need.
>
>Cool.
>

Yes, there exists programs that are simple (as there exist programming
languages that are simple)!

Actually what I do is to download several files from a server.
Some files/pages are generated by a script (so I have to post an
x-www-form-urlencoded string).

I don't want to use urllib2 because it (as I think) for every request
connects to the server, do the request and disconnect.

I need cookies because the server (as many other) authenticate user
with cookies.
So the simple algorithm is:

-connect to the server
-read a cookie from a file
-send the cookie to the server
-if the server send a cookie, the old one must be updated: with
standard Cookie this is simple: cookie.update(newcookie)
- ...
- save the cookie to a file


This is very simple to do with httplib and Cookie modules, so why to
use more involved modules?



Regards   Manlio Perillo



More information about the Python-list mailing list