def uploadFile(self, fullPath): if ( os.path.exists(fullPath) and os.path.isfile(fullPath)): fileName = os.path.basename(fullPath) form = {"metadata": fileName} files = {'body': (fileName, open(fullPath, 'rb'))} r = self.rest.POSTFiles(ClientURISettings.getUploadUri(), data=form, files=files) if ( r.status_code == HttpStatus.SC_OK ): logger.info("%s uploaded" % fileName) else: logger.error("%s upload failed, %s: " % (fileName, r.content)) return r