コード例 #1
0
ファイル: Client.py プロジェクト: kaltura/clients-generator
    def getParamsForMultiRequest(self, multiRequestIndex):
        self.params.put('service', self.service)
        self.params.put('action', self.action)

        multiRequestParams = KalturaParams()
        multiRequestParams.add(multiRequestIndex, self.params.get())
        return multiRequestParams.get()
コード例 #2
0
    def getParamsForMultiRequest(self, multiRequestIndex):
        self.params.put('service', self.service)
        self.params.put('action', self.action)

        multiRequestParams = KalturaParams()
        multiRequestParams.add(multiRequestIndex, self.params.get())
        return multiRequestParams.get()
コード例 #3
0
 def doHttpRequest(self, url, params=KalturaParams(), files=None):
     if not files:
         requestTimeout = self.config.requestTimeout
     else:
         # 10 seconds is a reasonable default timeout
         requestTimeout = 10
     r = self.openRequestUrl(url, params, files, self.requestHeaders,
                             requestTimeout)
     data = self.readHttpResponse(r)
     self.responseHeaders = r.headers
     return data
コード例 #4
0
    def queueServiceActionCall(self, service, action, returnType,
                               params=KalturaParams(), files=None):
        for param in self.requestConfiguration:
            if isinstance(self.requestConfiguration[param], KalturaObjectBase):
                params.addObjectIfDefined(
                    param, self.requestConfiguration[param])
            else:
                params.put(param, self.requestConfiguration[param])

        call = KalturaServiceActionCall(service, action, params, files)
        if (self.multiRequestReturnType is not None):
            self.multiRequestReturnType.append(returnType)
        self.callsQueue.append(call)
コード例 #5
0
 def __init__(self, service, action, params=KalturaParams(), files=None):
     self.service = service
     self.action = action
     self.params = params
     self.files = files
コード例 #6
0
    def getRequestParams(self):
        params = KalturaParams()
        files = {}
        for param in self.clientConfiguration:
            params.put(param, self.clientConfiguration[param])
        params.put("format", self.config.format)
        url = self.config.serviceUrl + "/api_v3"
        if (self.multiRequestReturnType is not None):
            url += "/service/multirequest"
            for i, call in enumerate(self.callsQueue):
                callParams = call.getParamsForMultiRequest(i)
                callFiles = call.getFilesForMultiRequest(i)
                params.update(callParams)
                if callFiles:
                    files.update(callFiles)
        else:
            call = self.callsQueue[0]
            url += "/service/" + call.service + "/action/" + call.action
            params.update(call.params.get())
            if call.files:
                files.update(call.files)

        signature = params.signature()
        params.put("kalsig", signature)

        self.log("request url: [%s]" % url)
        self.log("request json: [%s]" % params.toJson())

        return (url, params, files)
コード例 #7
0
ファイル: Client.py プロジェクト: kaltura/clients-generator
    def getRequestParams(self):
        params = KalturaParams()
        files = {}
        for param in self.clientConfiguration:
            params.put(param, self.clientConfiguration[param])
        params.put("format", self.config.format)
        url = self.config.serviceUrl + "/api_v3"
        if (self.multiRequestReturnType is not None):
            url += "/service/multirequest"
            for i, call in enumerate(self.callsQueue):
                callParams = call.getParamsForMultiRequest(i)
                callFiles = call.getFilesForMultiRequest(i)
                params.update(callParams)
                if callFiles:
                    files.update(callFiles)
        else:
            call = self.callsQueue[0]
            url += "/service/" + call.service + "/action/" + call.action
            params.update(call.params.get())
            if call.files:
                files.update(call.files)

        signature = params.signature()
        params.put("kalsig", signature)

        self.log("request url: [%s]" % url)
        self.log("request json: [%s]" % params.toJson())

        return (url, params, files)