def createFolder(self, strFolder):
        try:
            # build URI
            strURIRequest = self.strURIFolder + "/" + strFolder
            signedURI = Utils.Sign(Utils(), strURIRequest)

            responseStream = Utils.processCommand(Utils(), signedURI, "PUT", "", "")

            return responseStream

        except:
            raise "exception"
    def getSpaceInfo(self):
        try:
            # build URI
            strURI = self.strURIDisc

            # sign URI
            signedURI = Utils.Sign(Utils(), strURI)

            responseStream = Utils.processCommand(Utils(), signedURI, "GET", "JSON", "")

            return responseStream

        except:
            raise "exception"
    def getFolders(self):
        try:
            # build URI
            strURIRequest = self.strURIFolder
            signedURI = Utils.Sign(Utils(), strURIRequest)

            responseStream = Utils.processCommand(Utils(), signedURI, "GET", "JSON", "")

            if responseStream.status_code != 200:
                return False
            else:
                return responseStream

        except:
            raise "exception"
    def FileExists(self, fileName):
        try:
            if fileName == "":
                raise Exception("No file name specified")

                # build URI
            strURI = self.strURIExist + fileName

            # sign URI
            signedURI = Utils.Sign(Utils(), strURI)

            responseStream = Utils.processCommand(Utils(), signedURI, "GET", "JSON", "")

            return responseStream

        except:
            raise "exception"
    def DeleteFile(self, fileName):

        try:

            # //check whether file is set or not
            if fileName == "":
                raise Exception("No file name specified")

                # build URI
            strURI = self.strURIFile + fileName

            # sign URI
            signedURI = Utils.Sign(strURI)

            responseStream = json_decode(Utils.processCommand(signedURI, "DELETE", "", ""))
            if responseStream.code != 200:
                return False
            else:
                return True

        except:
            raise "exception"
Beispiel #6
0
 def GetPageCount(self):
     strURI = Product.BaseProductUri + "/pdf/" + self.FileName + "/pages"
     signedURI = Utils.Sign(strURI);
     responseStream = Utils.processCommand(signedURI, "GET", "");
     _json = json.loads(responseStream)
     return len(_json)