Example #1
0
    def setupBatchReports(self):
        self.batch = True
        self.batchSession = "BATCH-{0}".format(
            time.strftime("%y-%m-%d_%H-%M-%S"))
        self.batchDirectoryPath = FileUtils.buildPath(self.savePath, "reports",
                                                      self.batchSession)

        if not FileUtils.exists(self.batchDirectoryPath):
            FileUtils.createDirectory(self.batchDirectoryPath)

            if not FileUtils.exists(self.batchDirectoryPath):
                self.output.error("Couldn't create batch folder {}".format(
                    self.batchDirectoryPath))
                sys.exit(1)

        if FileUtils.canWrite(self.batchDirectoryPath):
            FileUtils.createDirectory(self.batchDirectoryPath)
            targetsFile = FileUtils.buildPath(self.batchDirectoryPath,
                                              "TARGETS.txt")
            FileUtils.writeLines(targetsFile, self.arguments.urlList)

        else:
            self.output.error("Couldn't create batch folder {}.".format(
                self.batchDirectoryPath))
            sys.exit(1)
Example #2
0
 def setupBatchReports(self):
     self.batch = True
     self.batchSession = "BATCH-{0}".format(time.strftime('%y-%m-%d_%H-%M-%S'))
     self.batchDirectoryPath = FileUtils.buildPath(self.script_path, 'reports', self.batchSession)
     if not FileUtils.exists(self.batchDirectoryPath):
         FileUtils.createDirectory(self.batchDirectoryPath)
         if not FileUtils.exists(self.batchDirectoryPath):
             self.output.error("Couldn't create batch folder {}".format(self.batchDirectoryPath))
             sys.exit(1)
     if FileUtils.canWrite(self.batchDirectoryPath):
         FileUtils.createDirectory(self.batchDirectoryPath)
         targetsFile = FileUtils.buildPath(self.batchDirectoryPath, "TARGETS.txt")
         FileUtils.writeLines(targetsFile, self.arguments.urlList)
     else:
         self.output.error("Couldn't create batch folder {}.".format(self.batchDirectoryPath))
         sys.exit(1)