diff --git a/crunch/api/domain/data_release.py b/crunch/api/domain/data_release.py index 9df2209..6eba0ed 100644 --- a/crunch/api/domain/data_release.py +++ b/crunch/api/domain/data_release.py @@ -26,6 +26,7 @@ def __repr__(self): @dataclasses.dataclass(frozen=True) class DataFile: + name: str url: str size: int signed: bool diff --git a/crunch/command/download.py b/crunch/command/download.py index 02a67ff..eaf8884 100644 --- a/crunch/command/download.py +++ b/crunch/command/download.py @@ -10,8 +10,8 @@ @dataclasses.dataclass class DataFile: - url: str path: str + url: str size: int signed: bool @@ -53,12 +53,12 @@ def get_file(data_file: api.DataFile) -> DataFile: url = data_file.url path = os.path.join( data_directory, - utils.get_name(url) + data_file.name ) return DataFile( - url, path, + url, data_file.size, data_file.signed ) diff --git a/crunch/utils.py b/crunch/utils.py index b638759..15207b2 100644 --- a/crunch/utils.py +++ b/crunch/utils.py @@ -288,12 +288,6 @@ def get_extension(url: str): raise click.Abort() -def get_name(url: str): - url = cut_url(url) - - return os.path.basename(url) - - def _download_head( session: requests.Session, url: str,