def u2handlers(self): '''Adds CustomHTTPErrorProcessor to handlers list''' handlers = HttpTransport.u2handlers(self) handlers.append(VerifiedHTTPSHandler(ca_certs=self.ca_certs)) handlers.append(CustomHTTPErrorProcessor()) return handlers
def create_suds_client(wsdl_url, key_data, cert_data, tbk_cert_data): transport = HttpTransport() wsse = Security() wsse_plugin = WssePlugin.init_from_data( key_data=key_data, cert_data=cert_data, tbk_cert_data=tbk_cert_data, ) return Client( url=wsdl_url, transport=transport, wsse=wsse, plugins=[wsse_plugin], )
def get_client(self,): transport=HttpTransport() wsse = Security() return Client( self._get_webpay_urls(), transport=transport, wsse=wsse, plugins=[ WssePlugin( keyfile=self.get_private_key(), certfile=self.get_public_cert(), their_certfile=self.get_WebPay_cert(), ), ], )
def __init__(self, *args, **kwargs): super(IBabsBaseExtractor, self).__init__(*args, **kwargs) try: ibabs_wsdl = self.source_definition['wsdl'] except Exception as e: ibabs_wsdl = settings.IBABS_WSDL try: self.client = Client(ibabs_wsdl, port='BasicHttpsBinding_IPublic', transport=HttpTransport(), timeout=10, headers={'User-Agent': settings.USER_AGENT}) except Exception as e: log.error('Unable to instantiate iBabs client: ' + str(e))
def get_client(): """ Obtenemos la informacion de nuestro cliente. """ return Client( settings.WEBPAY_WSDL, transport=HttpTransport(), wsse=Security(), plugins=[ WssePlugin( keyfile=settings.WEBPAY_OUR_PRIVATE_KEY, certfile=settings.WEBPAY_OUR_PUBLIC_CERT, their_certfile=settings.WEBPAY_CERT, ), ], )
def get_client(wsdl_url, our_keyfile_path, our_certfile_path, their_certfile_path): transport = HttpTransport() wsse = Security() return Client( wsdl_url, transport=transport, wsse=wsse, plugins=[ WssePlugin( keyfile=our_keyfile_path, certfile=our_certfile_path, their_certfile=their_certfile_path, ), ], )
def __init__(self, **kwargs): if 'ca_certs' in kwargs: self.ca_certs = kwargs['ca_certs'] del kwargs['ca_certs'] HttpTransport.__init__(self, **kwargs)
def __init__(self, key, cert, options = Options(),): HttpTransport.__init__(self)#, options) self.urlopener = urllib2.build_opener(HTTPSClientAuthHandler(key, cert))
######################### Basic Authentication import base64 class HTTPSudsPreprocessor(BaseHandler): def http_request(self, req): req.add_header('Content-Type', 'text/xml; charset=utf-8') req.add_header('WWW-Authenticate', 'Basic realm="Control Panel"') #The below lines are to encode the credentials automatically cred=userid+':'+passwd if cred!=None: enc_cred=base64.encodestring(cred) req.add_header('Authorization', 'Basic '+ enc_cred.replace('\012','')) return req https_request = http_request http = HttpTransport() opener = build_opener(HTTPSudsPreprocessor) http.urlopener = opener ######################### For Basic Authentication ################################# client = Client(url, location=url.replace('?wsdl',''), transport=http, cache=None, timeout=90, faults=False, retxml=True) ##################################################################################### def SendSOAPMessage(code, request): ##LogInput('core_send.py >> Looking for %s' % request.get('MessageCode')) if code == "NpRequest": try: