def _CreateMethod(self, method_name):
    """Create a method wrapping an invocation to the SOAP service.

    Args:
      method_name: A string identifying the name of the SOAP method to call.

    Returns:
      A callable that can be used to make the desired SOAP request.
    """
    soap_service_method = self.zeep_client.service[method_name]

    def MakeSoapRequest(*args):
      AddToUtilityRegistry('zeep')
      soap_headers = self._GetZeepFormattedSOAPHeaders()
      packed_args = self._PackArguments(method_name, args)
      try:
        return soap_service_method(
            *packed_args, _soapheaders=soap_headers)['body']['rval']
      except zeep.exceptions.Fault as e:
        error_list = ()
        if e.detail is not None:
          underlying_exception = e.detail.find(
              '{%s}ApiExceptionFault' % self._GetBindingNamespace())
          fault_type = self.zeep_client.get_element(
              '{%s}ApiExceptionFault' % self._GetBindingNamespace())
          fault = fault_type.parse(
              underlying_exception, self.zeep_client.wsdl.types)
          error_list = fault.errors or error_list
        raise googleads.errors.GoogleAdsServerFault(
            e.detail, errors=error_list, message=e.message)
    return MakeSoapRequest
def _CreateMethod ( self , method_name ) : soap_service_method = self . zeep_client . service [ method_name ] def MakeSoapRequest ( * args ) : AddToUtilityRegistry ( 'zeep' ) soap_headers = self . _GetZeepFormattedSOAPHeaders ( ) packed_args = self . _PackArguments ( method_name , args ) try : return soap_service_method ( * packed_args , _soapheaders = soap_headers ) [ 'body' ] [ 'rval' ] except zeep . exceptions . Fault as e : error_list = ( ) if e . detail is not None : underlying_exception = e . detail . find ( '{%s}ApiExceptionFault' % self . _GetBindingNamespace ( ) ) fault_type = self . zeep_client . get_element ( '{%s}ApiExceptionFault' % self . _GetBindingNamespace ( ) ) fault = fault_type . parse ( underlying_exception , self . zeep_client . wsdl . types ) error_list = fault . errors or error_list raise googleads . errors . GoogleAdsServerFault ( e . detail , errors = error_list , message = e . message ) return MakeSoapRequest
Create a method wrapping an invocation to the SOAP service.

    Args:
      method_name: A string identifying the name of the SOAP method to call.

    Returns:
      A callable that can be used to make the desired SOAP request.