Esempio n. 1
0
 def try_getting_hidden_pdf(self, pointer, filetype):
     try:
         binary = CdmAPI.retrieve_binary(self.alias, pointer)
     except urllib.error.HTTPError:
         print(self.alias, pointer, 'HTTP error caught on binary')
         self.unavailable_binaries.add((pointer, filetype))
         return False
     return binary
Esempio n. 2
0
 def try_getting_hidden_pdf(self, pointer, filetype):
     try:
         binary = CdmAPI.retrieve_binary(self.alias, pointer)
     except urllib.error.HTTPError:
         logging.warning('{} {} HTTP error caught on binary'.format(
             self.alias, pointer))
         return False
     return binary
Esempio n. 3
0
    def process_binary(self, target_dir, pointer, filetype):
        files = [file for root, dirs, files in self.tree_snapshot for file in files if target_dir == root]

        if '{}.{}'.format(pointer, filetype) not in files and '{}.{}'.format(pointer, filetype.lower()) not in files:
            try:
                CdmAPI.write_binary_to_file(
                    CdmAPI.retrieve_binary(self.alias, pointer),
                    target_dir,
                    pointer,
                    filetype)
                print('wrote', self.alias, pointer, filetype)
            except urllib.error.HTTPError:
                print(self.alias, pointer, 'HTTP error caught on binary')
                self.unavailable_binaries.add((pointer, filetype))
Esempio n. 4
0
 def process_binary(self, target_dir, pointer, filetype):
     files = [
         file for root, dirs, files in self.tree_snapshot for file in files
         if target_dir == root
     ]
     if '{}.{}'.format(pointer, filetype) not in files and '{}.{}'.format(
             pointer, filetype.lower()) not in files:
         try:
             CdmAPI.write_binary_to_file(
                 CdmAPI.retrieve_binary(self.alias, pointer), target_dir,
                 pointer, filetype)
             logging.info('{} {}.{} written'.format(self.alias, pointer,
                                                    filetype))
         except urllib.error.HTTPError:
             logging.warning('{} {} HTTP error caught on binary'.format(
                 self.alias, pointer))