def setup ( self , proxystr = '' , prompting = True ) : self . prompting = prompting proxy = self . get_proxy ( proxystr ) if proxy : proxy_support = urllib2 . ProxyHandler ( { "http" : proxy , "ftp" : proxy } ) opener = urllib2 . build_opener ( proxy_support , urllib2 . CacheFTPHandler ) urllib2 . install_opener ( opener )
set proxy using command prompt for python
Sets the proxy handler given the option passed on the command line . If an empty string is passed it looks at the HTTP_PROXY environment variable .
def setup(self, proxystr='', prompting=True):
        """
        Sets the proxy handler given the option passed on the command
        line.  If an empty string is passed it looks at the HTTP_PROXY
        environment variable.
        """
        self.prompting = prompting
        proxy = self.get_proxy(proxystr)
        if proxy:
            proxy_support = urllib2.ProxyHandler({"http": proxy, "ftp": proxy})
            opener = urllib2.build_opener(proxy_support, urllib2.CacheFTPHandler)
            urllib2.install_opener(opener)