def _urllib2Opener():
 debugMsg = 'creating HTTP requests opener object'
 logger.debug(debugMsg)
 handlers = [proxyHandler, authHandler, redirectHandler, rangeHandler, httpsHandler]
 if (not conf.dropSetCookie):
  if (not conf.loadCookies):
   conf.cj = cookielib.CookieJar()
  else:
   conf.cj = cookielib.MozillaCookieJar()
   resetCookieJar(conf.cj)
  handlers.append(urllib2.HTTPCookieProcessor(conf.cj))
 if conf.keepAlive:
  warnMsg = 'persistent HTTP(s) connections, Keep-Alive, has '
  warnMsg += 'been disabled because of its incompatibility '
  if conf.proxy:
   warnMsg += 'with HTTP(s) proxy'
   logger.warn(warnMsg)
  elif conf.authType:
   warnMsg += 'with authentication methods'
   logger.warn(warnMsg)
  else:
   handlers.append(keepAliveHandler)
 opener = urllib2.build_opener(*handlers)
 urllib2.install_opener(opener)

def _urllib2Opener ( ) : debugMsg = 'creating HTTP requests opener object' logger . debug ( debugMsg ) handlers = [ proxyHandler , authHandler , redirectHandler , rangeHandler , httpsHandler ] if ( not conf . dropSetCookie ) : if ( not conf . loadCookies ) : conf . cj = cookielib . CookieJar ( ) else : conf . cj = cookielib . MozillaCookieJar ( ) resetCookieJar ( conf . cj ) handlers . append ( urllib2 . HTTPCookieProcessor ( conf . cj ) ) if conf . keepAlive : warnMsg = 'persistent HTTP(s) connections, Keep-Alive, has ' warnMsg += 'been disabled because of its incompatibility ' if conf . proxy : warnMsg += 'with HTTP(s) proxy' logger . warn ( warnMsg ) elif conf . authType : warnMsg += 'with authentication methods' logger . warn ( warnMsg ) else : handlers . append ( keepAliveHandler ) opener = urllib2 . build_opener ( * handlers ) urllib2 . install_opener ( opener )
this function creates the urllib2 openerdirector .