|
|
@ -143,11 +143,14 @@ class Studip:
|
|
|
|
#total_size = int(rsp2.headers.get('content-length', 0))
|
|
|
|
#total_size = int(rsp2.headers.get('content-length', 0))
|
|
|
|
log.info('downloading ' + doc_name)
|
|
|
|
log.info('downloading ' + doc_name)
|
|
|
|
#progbar = tqdm(total=total_size, unit='iB', unit_scale=True)
|
|
|
|
#progbar = tqdm(total=total_size, unit='iB', unit_scale=True)
|
|
|
|
|
|
|
|
try:
|
|
|
|
with open(doc_name, 'wb') as doc_file:
|
|
|
|
with open(doc_name, 'wb') as doc_file:
|
|
|
|
for chunk in rsp2.iter_content(self.CHUNK_SIZE):
|
|
|
|
for chunk in rsp2.iter_content(self.CHUNK_SIZE):
|
|
|
|
#progbar.update(len(chunk))
|
|
|
|
#progbar.update(len(chunk))
|
|
|
|
doc_file.write(chunk)
|
|
|
|
doc_file.write(chunk)
|
|
|
|
self.db.set_last_file_dl(str(doc), str(int(time.time())))
|
|
|
|
self.db.set_last_file_dl(str(doc), str(int(time.time())))
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
log.CRITICAL("Error while writing to the file " + doc_name)
|
|
|
|
|
|
|
|
|
|
|
|
def get_subdirs(self, folder):
|
|
|
|
def get_subdirs(self, folder):
|
|
|
|
"""Get all the subdirectories of a given folder.
|
|
|
|
"""Get all the subdirectories of a given folder.
|
|
|
|