def do_open(self, http_class, req): if self.proxy is not None: req.set_proxy(self.proxy, "https") return urllib2.HTTPSHandler.do_open(self, ProxyHTTPSConnection, req)