def work(self, task): if not task: logging.info('keyword is invalid. Skip') return None keyword = task['keyword'] num_urls = int(task['num_urls']) image_urls = self.fetch_image_urls(keyword, num_urls) unique_filename = str(keyword) + '.txt' unique_filename = cogtu_misc.escape_space(cogtu_misc.escape_fwd_slash(unique_filename)) self.write_data_to_file(image_urls, unique_filename) return unique_filename
def work(self, keyword): if not keyword: logging.info('keyword is invalid. Skip') return None # s = random.random() * 10.0 # logging.info('SLEEPING FOR ' + str(s) + ' SECONDS') # sleep(s) # logging.info('SLEPT') info = self.fetch_info(keyword) unique_filename = str(keyword) + '.txt' unique_filename = cogtu_misc.escape_space(cogtu_misc.escape_fwd_slash(unique_filename)) self.write_data_to_file(info, unique_filename) return unique_filename