Last active
May 1, 2017 17:08
-
-
Save pablocastelo/c964df7252d12dbaf677403596a1800c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from requests import get | |
import os | |
import uuid | |
print('Reading list...') | |
df = pd.read_excel('list.xlsx') | |
f = df.to_dict(orient='records') | |
user_input = input("Enter a valid directory (leave blank to use this location): ") | |
if user_input != '': | |
base_dir = user_input | |
else: | |
os.system("mkdir placas/") | |
base_dir = 'placas/' | |
print('Starting to fetch files...') | |
for x in f[:100]: | |
ff = "{}{}/".format(base_dir, x['placa']) | |
os.system("mkdir {}".format(ff)) | |
with open("{}{}.{}".format(ff,x['link'][51:63], x['link'][64:67]), "wb") as file: | |
response = get(x['link']) | |
file.write(response.content) | |
print('Finished.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment