当前位置: 首页>>代码示例>>Python>>正文


Python Session.doRequest方法代码示例

本文整理汇总了Python中session.Session.doRequest方法的典型用法代码示例。如果您正苦于以下问题:Python Session.doRequest方法的具体用法?Python Session.doRequest怎么用?Python Session.doRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在session.Session的用法示例。


在下文中一共展示了Session.doRequest方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: killProcess

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
def killProcess(agent, user, password, pid):
    s = Session(agent, service="ProcessStop")
    s.authorize(user, password)

    response = s.doRequest(attributes={"PID" : str(pid)})

    return int(ElementTree.fromstring(response).get("ExitCode"))
开发者ID:DukeNuoDB,项目名称:nuodb-python,代码行数:9,代码来源:util.py

示例2: query

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
    def query(self, query_type, msg_body=None):
        session = Session(self.peer.connect_str, service="Manager")
        session.authorize(self.peer.domain.user, self.peer.domain.password)
        pwd_response = session.doRequest(attributes={"Type": "GetDatabaseCredentials", "Database": self.database.name})

        pwd_xml = ElementTree.fromstring(pwd_response)
        pwd = pwd_xml.find("Password").text.strip()

        return queryEngine(self.address, self.port, query_type, pwd, msg_body)
开发者ID:jgetto,项目名称:nuodb-python,代码行数:11,代码来源:entity.py

示例3: query

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
    def query(self, type, msgBody=None):
        s = Session(self.getPeer().getConnectStr(), service="Manager")
        s.authorize(self.getPeer().getDomain().getUser(), self.getPeer().getDomain().getPassword())
        pwdResponse = s.doRequest(attributes={"Type": "GetDatabaseCredentials", "Database": self.getDbName()})

        pwdXml = ElementTree.fromstring(pwdResponse)
        pwd = pwdXml.find("Password").text.strip()

        return queryEngine(self.getAddress(), self.getPort(), type, pwd, msgBody)
开发者ID:princeirmal,项目名称:nuodb-python,代码行数:11,代码来源:entity.py

示例4: getArchiveHistory

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
def getArchiveHistory(agent, user, password, archive, options=None):
    s = Session(agent, service="ProcessStart")
    s.authorize(user, password)

    option = _OPTION_VALUE_STR % ("--archive", archive)
    opts = [ ElementTree.fromstring(option) ]

    if options:
        for (k,v) in options:
            if v:
                option = _OPTION_VALUE_STR % (k, v)
            else:
                option = _OPTION_FLAG_STR % k
            opts.append(ElementTree.fromstring(option))

    return s.doRequest(attributes={"Process" : "archiveHistory"}, children=opts)
开发者ID:DukeNuoDB,项目名称:nuodb-python,代码行数:18,代码来源:util.py

示例5: startProcess

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
def startProcess(agent, user, password, db_name, options=None):
    s = Session(agent, service="ProcessStart")
    s.authorize(user, password)

    if not options:
        options = []

    options.append(("--database", db_name))

    opts = []
    for (k,v) in options:
        if v:
            optStr = _OPTION_VALUE_STR % (k, v)
        else:
            optStr = _OPTION_FLAG_STR % k
        opts.append(ElementTree.fromstring(optStr))

    return s.doRequest(attributes={"Process" : "server"}, children=opts)
开发者ID:DukeNuoDB,项目名称:nuodb-python,代码行数:20,代码来源:util.py

示例6: find_peer

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
    def find_peer(self, address, port=None):
        """
        Find a peer by address
        @type: address str
        @type: port int or str
        @rtype: Peer
        """
        if port is None:
            if ":" in address:
                address, port = address.split(":", 2)
            else:
                port = self.__entry_peer.port
        else:
            if ":" in address:
                address, _ = address.split(":", 2)

        ip = socket.gethostbyname(address)
        inet_sock_addr = ":".join([ip, str(port)])
        try:
            return self.__peers_by_addr[inet_sock_addr]
        except:
            pass

        session = Session(address, port=port, service="Identity")
        session.authorize(self.__user, self.__password)
        response = session.doRequest()
        try:
            root = ElementTree.fromstring(response)
            if self.__domain_name != root.get("Domain"):
                return None
            peer = self.get_peer(root.get("AgentId"))
            if peer:
                self.__peers_by_addr[peer._get_normalized_addr()] = peer
            return peer
        except:
            return None
开发者ID:jgetto,项目名称:nuodb-python,代码行数:38,代码来源:entity.py

示例7: getState

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
def getState(broker, user, password):
    s = Session(broker, service="State")
    s.authorize(user, password)
    
    return s.doRequest()
开发者ID:DukeNuoDB,项目名称:nuodb-python,代码行数:7,代码来源:util.py

示例8: getIdentity

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
def getIdentity(agent):
    s = Session(agent, service="Identity")

    return s.doRequest()
开发者ID:DukeNuoDB,项目名称:nuodb-python,代码行数:6,代码来源:util.py

示例9: setLicense

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
def setLicense(broker, user, password, licenseText):
    s = Session(broker, service="License")
    s.authorize(user, password)

    s.doRequest(attributes={ "Action" : "ApplyLicense" }, text=licenseText)
开发者ID:DukeNuoDB,项目名称:nuodb-python,代码行数:7,代码来源:util.py

示例10: getLicense

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
def getLicense(broker, user, password):
    s = Session(broker, service="License")
    s.authorize(user, password)

    return s.doRequest(attributes={ "Action" : "GetCurrentLicense" })
开发者ID:DukeNuoDB,项目名称:nuodb-python,代码行数:7,代码来源:util.py

示例11: _send_domain_message

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import doRequest [as 别名]
 def _send_domain_message(self, service, attributes=None, text=None, children=None):
     session = Session(self.__entry_peer.address, port=self.__entry_peer.port, service=service)
     session.authorize(self.__user, self.__password)
     return session.doRequest(attributes, text, children)
开发者ID:keithmcneill,项目名称:nuodb-python,代码行数:6,代码来源:entity.py


注:本文中的session.Session.doRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。