Похожие чаты

How can I can limit download size to 1 mb

?
self.MAX_SIZE = 1000000 # 1024 * 1024 this doesnt work either
try:
response = requests.head(href)
total = response.headers.get('content-length')
if int(total) > self.MAX_SIZE:
print "maximum size (%d kbs)" % (self.MAX_SIZE/1024)
else:
if total is None:
pass
else:
#if os.path.exists(OUTPUT_DIR):
# print("Deleting old output directory")
# shutil.rmtree(OUTPUT_DIR)
#print("Creating output directory")
#os.mkdir(OUTPUT_DIR)
os.system('wget -P %s %s'%(OUTPUT_DIR, href))
except Exception as e:
pass

1 ответов

10 просмотров

what are you trying to do

Похожие вопросы

Обсуждают сегодня

Карта сайта