當前位置: 首頁>>代碼示例>>Python>>正文


Python SOAPpy.parseSOAPRPC方法代碼示例

本文整理匯總了Python中SOAPpy.parseSOAPRPC方法的典型用法代碼示例。如果您正苦於以下問題:Python SOAPpy.parseSOAPRPC方法的具體用法?Python SOAPpy.parseSOAPRPC怎麽用?Python SOAPpy.parseSOAPRPC使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SOAPpy的用法示例。


在下文中一共展示了SOAPpy.parseSOAPRPC方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: render

# 需要導入模塊: import SOAPpy [as 別名]
# 或者: from SOAPpy import parseSOAPRPC [as 別名]
def render(self, request):
        """Handle a SOAP command."""
        data = request.content.read()

        p, header, body, attrs = SOAPpy.parseSOAPRPC(data, 1, 1, 1)

        methodName, args, kwargs, ns = p._name, p._aslist, p._asdict, p._ns

        # deal with changes in SOAPpy 0.11
        if callable(args):
            args = args()
        if callable(kwargs):
            kwargs = kwargs()

        function = self.lookupFunction(methodName)

        if not function:
            self._methodNotFound(request, methodName)
            return server.NOT_DONE_YET
        else:
            if hasattr(function, "useKeywords"):
                keywords = {}
                for k, v in kwargs.items():
                    keywords[str(k)] = v
                d = defer.maybeDeferred(function, **keywords)
            else:
                d = defer.maybeDeferred(function, *args)

        d.addCallback(self._gotResult, request, methodName)
        d.addErrback(self._gotError, request, methodName)
        return server.NOT_DONE_YET 
開發者ID:adde88,項目名稱:hostapd-mana,代碼行數:33,代碼來源:soap.py

示例2: _cbGotResult

# 需要導入模塊: import SOAPpy [as 別名]
# 或者: from SOAPpy import parseSOAPRPC [as 別名]
def _cbGotResult(self, result):
        result = SOAPpy.parseSOAPRPC(result)
        if hasattr(result, 'Result'):
            return result.Result
        elif len(result) == 1:
            ## SOAPpy 0.11.6 wraps the return results in a containing structure.
            ## This check added to make Proxy behaviour emulate SOAPProxy, which
            ## flattens the structure by default.
            ## This behaviour is OK because even singleton lists are wrapped in
            ## another singleton structType, which is almost always useless.
            return result[0]
        else:
            return result 
開發者ID:adde88,項目名稱:hostapd-mana,代碼行數:15,代碼來源:soap.py

示例3: _got_page

# 需要導入模塊: import SOAPpy [as 別名]
# 或者: from SOAPpy import parseSOAPRPC [as 別名]
def _got_page(self, result):
        """
        The http POST command was successful, we parse the SOAP
        answer, and return it.
        
        @param result: the xml content
        """
        parsed = SOAPpy.parseSOAPRPC(result)
        
        logging.debug("SOAP Answer:\n%s", result)
        logging.debug("SOAP Parsed Answer: %r", parsed)
        
        return parsed 
開發者ID:amarian12,項目名稱:p2pool-bch,代碼行數:15,代碼來源:soap.py

示例4: _got_error

# 需要導入模塊: import SOAPpy [as 別名]
# 或者: from SOAPpy import parseSOAPRPC [as 別名]
def _got_error(self, res):
        """
        The HTTP POST command did not succeed, depending on the error type:
            - it's a SOAP error, we parse it and return a L{SoapError}.
            - it's another type of error (http, other), we raise it as is
        """
        logging.debug("SOAP Error:\n%s", res)
        
        if isinstance(res.value, error.Error):
            try:
                logging.debug("SOAP Error content:\n%s", res.value.response)
                raise SoapError(SOAPpy.parseSOAPRPC(res.value.response)["detail"])
            except:
                raise
        raise Exception(res.value) 
開發者ID:amarian12,項目名稱:p2pool-bch,代碼行數:17,代碼來源:soap.py

示例5: render

# 需要導入模塊: import SOAPpy [as 別名]
# 或者: from SOAPpy import parseSOAPRPC [as 別名]
def render(self, request):
        """Handle a SOAP command."""
        data = request.content.read()

        p, header, body, attrs = SOAPpy.parseSOAPRPC(data, 1, 1, 1)

        methodName, args, kwargs = p._name, p._aslist, p._asdict

        # deal with changes in SOAPpy 0.11
        if callable(args):
            args = args()
        if callable(kwargs):
            kwargs = kwargs()

        function = self.lookupFunction(methodName)

        if not function:
            self._methodNotFound(request, methodName)
            return server.NOT_DONE_YET
        else:
            if hasattr(function, "useKeywords"):
                keywords = {}
                for k, v in kwargs.items():
                    keywords[str(k)] = v
                d = defer.maybeDeferred(function, **keywords)
            else:
                d = defer.maybeDeferred(function, *args)

        d.addCallback(self._gotResult, request, methodName)
        d.addErrback(self._gotError, request, methodName)
        return server.NOT_DONE_YET 
開發者ID:squeaky-pl,項目名稱:zenchmarks,代碼行數:33,代碼來源:soap.py


注:本文中的SOAPpy.parseSOAPRPC方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。