is this python code with urllib2 with cookies thread safe? -


i'm trying run multiple threads urllib2 w/ cookies. have function 1 below run in 5 threads simultaneously. i'm not installing opener running in each thread.

def myfunction(inputvar):     opener = urllib2.build_opener(urllib2.httpcookieprocessor()) 

is thread safe? if isn't because python modules need thread safe regardless of scope?

that should thread-safe. if @ source code urllib2.py neither _build_opener_ function nor httpcookieprocessor() use global state. _build_opener_ function returns new openerdirector object self-contained. each thread have own set of objects won't interfere 1 another.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -