Skip to content

Instantly share code, notes, and snippets.

@facundoq facundoq/
Created Apr 15, 2019

What would you like to do?
Structuring downloads
from abc import ABC,abstractmethod
class DownloadFile(ABC):
def __init__(self, url, filepath):
self.url = url
self.filepath = filepath
def download(self):
class DownloadError(Exception):
def __init__(self,download_file,error):
class DownloadFileHTTP(DownloadFile):
def download(self):
#<do the download>
# if download unsuccesfull, raise DownloadError(self,reason)
class XYZDatasetLoader(DatasetLoader):
def __init__(self,folderpath):
self.download_files=[ DownloadFileHTTP("",os.path.join(folderpath,""))
class DatasetLoader():
def download_files(self):
#..... all other stuff
def download_dataset(self):
for download_file in self.download_files:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.