def __init__(self, files_manager, report_all = False): self.files_manager = files_manager #this is the same object that was created in the interface class! (or any other class thtat initiate us. self.text_analyzer = text_analyzer() self.report = list() self.report_all = report_all if debug_mode(): print('download_manager initiated.')
def main(filename): with open(filename) as text: intText = list(map(int, text.read().split(','))) chrText = list(map(chr, intText)) frequencies = text_analyzer.text_analyzer(filename) print('\nCreating brute force encryption file...') brute_force.brute_force_encrypt(chrText, 97, 123) print('Please review the created file to obtain the password') password = input('\nWhat is the determined password: '******'\nThe sum of the encrypted message is %d' % sum(message))
def __init__(self, from_time, feed_url, up_to_time = False): """from_time - the time to check torrents that a newer from up_to_time - check just up to this time, but ignore from_time. Can be given as time since the Epoch or as "%H:%M %d/%m/%Y" string format.""" self.torrents = list() #here we will collect the torrents to download. self.text_analyzer = text_analyzer() #our text analyzing toolset #lets just make sure that its a proper time. if from_time: try: if type(from_time) == float: self.time = from_time else: self.time = time.mktime(time.strptime(str(from_time).strip(), "%H:%M:%S %d/%m/%Y")) except ValueError: raise ValueError(' time was not set properly, please fix it.') else: self.time = 0 #that means we want to check the full RSS feed. self.temp_time = self.time if up_to_time: try: if type(up_to_time) == float: self.up_to_time = up_to_time else: self.up_to_time = time.mktime(time.strptime(str(up_to_time).strip(), "%H:%M:%S %d/%m/%Y")) except ValueError: raise ValueError(' time was not set properly, please fix it.') else: self.up_to_time = False try: if debug_mode(): print("torrents_grabber.__init__(). feed_url = %s" % feed_url) self.feed = urllib.request.urlopen(feed_url, timeout=3) except urllib.error.HTTPError: raise IOError('No feed found') except urllib.error.URLError as message: if message.args[0] == 'unknown url type: https': print('Warrning, I can not open this httpS type url, if you still want to user the site {}, please change the address type.'.format(feed_url)) raise IOError("can't load given rss feed") if debug_mode(): print('torrents_grabber.__init__(). initiated for %s' % feed_url)