Client-side cookies on Python in Mac OSX

A

Adrian Petrescu

Hi, all. I'm writing an app for OS X; therefore I'd prefer to use only
the default python install that comes with Tiger. For the moment,
however, this means:

NaviOSX:~ adrianpetrescu$ python -V
Python 2.3.5

Therefore, I was not surprised to find out that cookielib did not
exist here, since I knew that it was a 2.4+ feature.

However, I *was* shocked to find out that ClientCookie, which I'd
thought was a Python 2.0+ feature, also cannot be found:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named ClientCookie

Why would Apple go out of their way to remove this functionality from
their shipped version of Python? More importantly, considering I need
to programatically access a website that uses cookies for
authentication, how can I do this in OSX's Python install? Do they
provide some other library they'd prefer you to use?

I'm sure SOMEONE in the world has used cookies on Macs so I'm hoping
there is a solution for this...

Thanks in advance!
-- Adrian Petrescu
 
G

Graham Dumpleton

Hi, all. I'm writing an app for OS X; therefore I'd prefer to use only
the default python install that comes with Tiger. For the moment,
however, this means:

NaviOSX:~ adrianpetrescu$ python -V
Python 2.3.5

Therefore, I was not surprised to find out that cookielib did not
exist here, since I knew that it was a 2.4+ feature.

However, I *was* shocked to find out that ClientCookie, which I'd
thought was a Python 2.0+ feature, also cannot be found:


Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named ClientCookie

Why would Apple go out of their way to remove this functionality from
their shipped version of Python? More importantly, considering I need
to programatically access a website that uses cookies for
authentication, how can I do this in OSX's Python install? Do they
provide some other library they'd prefer you to use?

I'm sure SOMEONE in the world has used cookies on Macs so I'm hoping
there is a solution for this...

They didn't remove it, it was never there in the first place.

The ClientCookie site says 'Python 2.0 or above is required'. It
doesn't say it is included with Python distributions. The package
still has to be installed separately. See:

http://wwwsearch.sourceforge.net/ClientCookie/

Graham
 
A

Adrian Petrescu

Oh, you're right! Silly me, I had always thought it was standard.
Thanks for pointing this out! I went and downloaded ClientCookie and
it works great on OS X. And since it is BSD-licensed, I can use it in
my app without any fear. Perfect.

Thank you, Graham!
 
J

John J. Lee

Adrian Petrescu said:
Oh, you're right! Silly me, I had always thought it was standard.
Thanks for pointing this out! I went and downloaded ClientCookie and
it works great on OS X. And since it is BSD-licensed, I can use it in
my app without any fear. Perfect.

Thank you, Graham!

The relationship is that cookielib is derived from ClientCookie:
essentially the same code, cleaned up to take advantage of newer
Python features, renamed to 'cookielib' and added to the stdlib.


The other difference is in thread synchronisation: ClientCookie had
some broken thread synchronisation at one point, which was
subsequently removed (which doesn't imply ClientCookie is not useful
in threaded code). Though an unfortunate series of events the
released cookielib ended up with that broken thread synchronisation
code. It seems at least some of those thread synchronisation bugs in
cookielib are fixed in the lastest version of Python.

http://python.org/sf/1484758

http://python.org/sf/1587139



John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top