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


Python server_request.ServerRequest类代码示例

本文整理汇总了Python中cpc.network.server_request.ServerRequest的典型用法代码示例。如果您正苦于以下问题:Python ServerRequest类的具体用法?Python ServerRequest怎么用?Python ServerRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addNodeAccepted

    def addNodeAccepted(self):
        conf = ServerConf()

        inf = open(conf.getCACertFile(), "r")
        key = inf.read()
        #only sending fqdn the requesting should already know the unqualified
        # hostname
        node = NodeConnectRequest(conf.getServerId(),
            conf.getClientSecurePort(),
            conf.getServerSecurePort(),
            key,
            conf.getFqdn(),
            None)
        cmdstring ='node-connection-accepted'
        fields = []
        input=Input('cmd',cmdstring)


        input2=Input('connectRequest',
            json.dumps(node,default=json_serializer.toJson,indent=4))


        fields.append(input)
        fields.append(input2)
        fields.append(Input('version', "1"))

        # this goes over  client secure port , and we don't want the server to use
        # cookies 
        response= self.postRequest(ServerRequest.prepareRequest(fields),
            require_certificate_authentication=False,
            disable_cookies=True)
        return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:32,代码来源:untrusted_server_message.py

示例2: commandFinishedForwardedRequest

    def commandFinishedForwardedRequest(self, cmdID, workerServer,
                                        projectServer, returncode,
                                        cputime, haveData):
        """A server-to-sever request doing command-finished. Used in
            forwarding non-local command-finished requests."""
        cmdstring='command-finished-forward'
        fields = []
        input = Input('cmd', cmdstring)
        fields.append(input)
        fields.append(Input('cmd_id', cmdID))
        fields.append(Input('version', "1"))
        fields.append(Input('worker_server', workerServer))
        fields.append(Input('project_server', projectServer))
        if returncode is not None:
            fields.append(Input('return_code', returncode))
        fields.append(Input('used_cpu_time', cputime))
        if haveData:
            fields.append(Input('run_data', 1))

        #the files are not sent in this message, instead they are pulled 
        # from the project server upon receiving this message (for now)
        files = []
        headers = dict()
        #headers['end-node'] = self.host
        #headers['end-node-port'] = self.port
        #self.connect()
        #log.debug("forwarding command finished to %s"%self.endNode)
        response= self.putRequest(ServerRequest.prepareRequest(fields, files,
            headers))
        return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:30,代码来源:server_message.py

示例3: __persistConnection

    def __persistConnection(self,direction,headers = dict()):
        headers['persistent-connection'] = direction
        #message body is actually irrellevant and is not read on the other
        # side.
        #we just need to conform to the http protocol
        fields = []
        fields.append(Input('cmd', "persist-connection"))

        #sending along the connection parameters for this server
        conf = ServerConf()
        connectionParams = dict()
        connectionParams['serverId'] = conf.getServerId()
        connectionParams['hostname'] = conf.getHostName()
        connectionParams['fqdn'] = conf.getFqdn()
        connectionParams['client_secure_port'] = conf\
        .getClientSecurePort()
        connectionParams['server_secure_port'] = conf\
        .getServerSecurePort()


        input2 = Input('connectionParams',
            json.dumps(connectionParams,default = json_serializer.toJson,
                indent=4))  # a json structure that needs to be dumped
        fields.append(input2)


        response= self.putRequest(ServerRequest.prepareRequest(fields, [],
            headers))

        return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:30,代码来源:direct_message.py

示例4: projectGetDefaultRequest

 def projectGetDefaultRequest(self):
     """Get the default project project name"""
     cmdstring="project-get-default"
     fields = []
     fields.append(Input('cmd', cmdstring))
     fields.append(Input('version', "1"))
     response= self.postRequest(ServerRequest.prepareRequest(fields, []))
     return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:8,代码来源:message.py

示例5: projectRollbackRequest

 def projectRollbackRequest(self, project):
     """Cancel a series of previously scheduled set&connect requests."""
     cmdstring="project-rollback"
     fields = []
     fields.append(Input('cmd', cmdstring))
     fields.append(Input('version', "1"))
     response= self.postRequest(ServerRequest.prepareRequest(fields, []))
     return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:8,代码来源:message.py

示例6: listModules

 def listModules(self):
     cmdString = "list-modules"
     fields  = []
     input = Input('cmd',cmdString)
     fields.append(input)
     fields.append(Input('version', "1"))
     msg = ServerRequest.prepareRequest(fields,[])
     return self.postRequest(msg)
开发者ID:abhirathb,项目名称:copernicus,代码行数:8,代码来源:message.py

示例7: projectsRequest

 def projectsRequest(self):
     """List all projects"""
     cmdstring="projects"
     fields = []
     fields.append(Input('cmd', cmdstring))
     fields.append(Input('version', "1"))
     response= self.postRequest(ServerRequest.prepareRequest(fields, []))
     return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:8,代码来源:message.py

示例8: projectCommitRequest

 def projectCommitRequest(self, project):
     """Commit a series of previously scheduled set&connect requests, 
        atomically."""
     cmdstring="project-commit"
     fields = []
     fields.append(Input('cmd', cmdstring))
     fields.append(Input('version', "1"))
     response= self.postRequest(ServerRequest.prepareRequest(fields, []))
     return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:9,代码来源:message.py

示例9: serverInfo

 def serverInfo(self):
     cmdstring='server-info'
     fields = []
     input = Input('cmd', cmdstring)
     fields.append(input)
     fields.append(Input('version', "1"))
     msg = ServerRequest.prepareRequest(fields,[])
     response= self.postRequest(msg)
     return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:9,代码来源:message.py

示例10: stopRequest

 def stopRequest(self): 
     cmdstring="stop"
     fields = []
     input = Input('cmd', cmdstring)   
     fields.append(input)
     fields.append(Input('version', "1"))
     response= self.postRequest(ServerRequest.prepareRequest(fields, []))
     #response= self.putRequest(ServerRequest.prepareRequest(fields, []))
     return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:9,代码来源:message.py

示例11: projectStartRequest

 def projectStartRequest(self, name):
     """Start a new empty project """
     cmdstring="project-start"
     fields = []
     fields.append(Input('cmd', cmdstring))
     fields.append(Input('version', "1"))
     fields.append(Input('name',name))
     response= self.postRequest(ServerRequest.prepareRequest(fields, []))
     return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:9,代码来源:message.py

示例12: saveStateRequest

 def saveStateRequest(self):
     """Tell the server to save its state now."""
     cmdstring="save-state"
     fields = []
     input = Input('cmd', cmdstring)   
     fields.append(input)
     fields.append(Input('version', "1"))
     response= self.postRequest(ServerRequest.prepareRequest(fields, []))
     return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:9,代码来源:message.py

示例13: readConfRequest

 def readConfRequest(self):
     """Tell the server to re-read its configuration."""
     cmdstring="readconf"
     fields = []
     input = Input('cmd', cmdstring)   
     fields.append(input)
     fields.append(Input('version', "1"))
     response= self.postRequest(ServerRequest.prepareRequest(fields, []))
     return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:9,代码来源:message.py

示例14: deleteUser

 def deleteUser(self, user):
     cmdstring="delete-user"
     fields = []
     input = Input('cmd', cmdstring)
     fields.append(input)
     fields.append(Input('user', user))
     msg = ServerRequest.prepareRequest(fields,[])
     response = self.postRequest(msg)
     return response
开发者ID:abhirathb,项目名称:copernicus,代码行数:9,代码来源:message.py

示例15: revokeNode

 def revokeNode(self,serverId):
     cmdString = "revoke-node"
     fields  = []
     input = Input('cmd',cmdString)
     fields.append(input)
     fields.append(Input('version', "1"))
     fields.append(Input('serverId',serverId))
     msg = ServerRequest.prepareRequest(fields,[])
     return self.postRequest(msg)
开发者ID:abhirathb,项目名称:copernicus,代码行数:9,代码来源:message.py


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