def request(self, host, handler, request_body, verbose):
        '''Send xml-rpc request using proxy'''
        #We get a traceback if we don't have this attribute:
        self.verbose = verbose
        url = 'http://' + host + handler
        request = urllib2.Request(url)
        request.add_data(request_body)
        # Note: 'Host' and 'Content-Length' are added automatically
        request.add_header('User-Agent', self.user_agent)
        request.add_header('Content-Type', 'text/xml')
        proxy_handler = urllib2.ProxyHandler()
        opener = urllib2.build_opener(proxy_handler)
        fhandle = opener.open(request)
        return(self.parse_response(fhandle))
def request ( self , host , handler , request_body , verbose ) : self . verbose = verbose url = 'http://' + host + handler request = urllib2 . Request ( url ) request . add_data ( request_body ) request . add_header ( 'User-Agent' , self . user_agent ) request . add_header ( 'Content-Type' , 'text/xml' ) proxy_handler = urllib2 . ProxyHandler ( ) opener = urllib2 . build_opener ( proxy_handler ) fhandle = opener . open ( request ) return ( self . parse_response ( fhandle ) )
Send xml-rpc request using proxy