def get_data(self, save_directory):
"""
Retrieves data from remote location
saves data in: save_directory
TODO:
figure out how to handle local file paths
consider directory downloads from html pages with hyperlinks
** Impliment custom URL schemes -- Now needs to be done in lasubway.py
How does raw data fit into this function?
"""
url = urlunparse(self)
file_name = os.path.basename(os.path.normpath(self.path))
save_path = os.path.join(save_directory, file_name)
with closing(urlopen(url)) as request:
with open(save_path, 'wb') as sfile:
shutil.copyfileobj(request, sfile)
评论列表
文章目录