Normalde başka bir kod kullanıyordum ama onda nereye kaydedeceğini ayarlayamıyordum. Dosyanın açıldığı dizine kaydediyordu. Dosyanın nereye ineceği ve indirme çubuğu ile nasıl yapabilirim?
I have a Python script that launches a URL that is a downloadable file. Is there some way to have Python display the download progress as oppose to launching the browser?
I have a Python script that launches a URL that is a downloadable file. Is there some way to have Python display the download progress as oppose to launching the browser?
I have a Python script that launches a URL that is a downloadable file. Is there some way to have Python display the download progress as oppose to launching the browser?
Alttaki verdiğiniz linkteki
from clint.textui import progress
r = requests.get(url, stream=True)
path = '/some/path/for/file.txt'
with open(path, 'wb') as f:
total_length = int(r.headers.get('content-length'))
for chunk in progress.bar(r.iter_content(chunk_size=1024), expected_size=(total_length/1024) + 1):
if chunk:
f.write(chunk)
f.flush()
İşime yaradı. Teşekkürler, çözüm ilettim.
Bunu indirdikten sonra otomatik açmak mümkün mü? İf sorgusu ile yapılır ama bellek kullanımı fazla olur. İndirmeyi def ile tanimladiktan sonra inince onu çalıştırması mümkün mü?