2019-05-10 10:21:21 -07:00
|
|
|
import os
|
|
|
|
|
import pandas
|
|
|
|
|
import sys
|
|
|
|
|
import urllib.request as urllib
|
|
|
|
|
import pandas as pd
|
2019-06-02 04:36:25 -07:00
|
|
|
import json
|
|
|
|
|
import requests
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
|
|
from process_data import create_map_list
|
2019-05-10 10:21:21 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
lf=[]
|
|
|
|
|
|
2019-05-11 11:22:42 -07:00
|
|
|
def download_data(x,dir_name):
|
|
|
|
|
fname=x.split("/")[-1]
|
|
|
|
|
path=os.path.join(dir_name,fname)
|
|
|
|
|
urllib.urlretrieve(x,path)
|
2019-05-10 10:21:21 -07:00
|
|
|
|
2019-05-11 11:22:42 -07:00
|
|
|
def get_data_file(file,dir):
|
2019-05-10 10:21:21 -07:00
|
|
|
if not os.path.isfile(file):
|
|
|
|
|
print("The specified file does not exist!!!")
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
with open(file,"r")as f:
|
|
|
|
|
lf=f.read().splitlines()
|
|
|
|
|
|
2019-05-11 11:22:42 -07:00
|
|
|
if not os.path.exists(dir):
|
|
|
|
|
os.mkdir(dir)
|
2019-05-10 10:21:21 -07:00
|
|
|
for x in lf:
|
2019-05-11 11:22:42 -07:00
|
|
|
download_data(x,dir)
|
2019-06-02 04:36:25 -07:00
|
|
|
|