Skip to content

Instantly share code, notes, and snippets.

@todd814
Last active June 8, 2018 15:27
Show Gist options
  • Select an option

  • Save todd814/c6a49f2957ae56a2269b41f8d1520caf to your computer and use it in GitHub Desktop.

Select an option

Save todd814/c6a49f2957ae56a2269b41f8d1520caf to your computer and use it in GitHub Desktop.
dl from web for files listed in csv in python change the chunk size for bigger faster dl's
import requests
import csv
url = "{yoururl/}"
#obtain files from CSV
with open('archived_files.csv') as csvfile:
readCSV = csv.reader(csvfile)
for row in readCSV:
filename = row[0]
print(filename)
truepath = url + filename
# create response object
r = requests.get(truepath, stream=True, verify=False)
# download started
with open(filename, 'wb') as f:
for chunk in r.iter_content(chunk_size=1):
if chunk:
f.write(chunk)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment