cookielib and urllib2: thread-safe?

Alex Hunsley lard at
Wed Jan 26 10:35:59 EST 2005

I'm writing a test script in python for pulling web pages from a web 
server using urllib2 and cookielib. Since the main thing I am testing is 
what happens when concurrent requests are made to the web server, I need 
to make several requests concurrently, which I'll do from different 
threads in my python script. So the important question is: are cookielib 
and urllib2 thread safe? Are there any precautions that apply to using 
these libs in a multi-threaded context?


More information about the Python-list mailing list