def download(connection, priv_key, server_pub_key): """ Download a file from the server :param connection: Connection to the server :param priv_key: Client's private key :param server_pub_key: Server's public key """ # Get the filename from the user file_name = input( 'What file would you like to download from the server?: ') # Tell the server to prepare to download a file connection.sendall(rsa.encrypt(b'DOWNLOAD', server_pub_key)) # Send the file name to the server connection.sendall(rsa.encrypt(file_name.encode(), server_pub_key)) # Attempt to download the file try: shared.download_file(connection, priv_key, file_name) # If the server can't find the file that is asked for except ValueError: print(''.join(['\nThe file does not exist']), file=sys.stderr)
def download(self, target_path): data_dict = {"action": "nzb"} data_dict[self.id_] = "on" self.spider.session.headers['Referer'] = self.searchurl response = self.spider.session.post("https://www.binsearch.info/fcgi/nzb.fcgi", params={ "q": self.name, "m": "", "adv_age": "600", "max": "100", "adv_g": "", "adv_sort": "date", "minsize": "100", "maxsize": "", "adv_col": "on", "adv_nfo": "on", "font": "", "postdate": "", "server": "" }, data=data_dict) download_file(response, target_path)
def download(self, target_path): download_file(self.spider.session.get(self.url), target_path)
def worker(): while len(files) > 0: filename = files.pop() download_file(bucket_name, filename, output_dir)
def main(): while (len(lines) > 0): filename = lines.pop() download_file(bucket_name, filename, output_dir)
def worker(): while True: filename = q.get() download_file(bucket_name, filename, output_dir) q.task_done()