1with open(filename, 'wb') as fd:
2 total = ftpclient.size(filename)
3
4 with tqdm(total=total) as pbar:
5 def callback_(data):
6 l = len(data)
7 pbar.update(l)
8 fd.write(data)
9
10 ftpclient.retrbinary('RETR {}'.format(filename), callback_)
11