Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kacperlukawski/632f8c481eb651d8eb8004caa02b9edf to your computer and use it in GitHub Desktop.
Save kacperlukawski/632f8c481eb651d8eb8004caa02b9edf to your computer and use it in GitHub Desktop.
from pathlib import Path
from urllib.request import urlretrieve
from embetter.base import EmbetterBase
class DownloadFile(EmbetterBase):
def __init__(self, out_dir: Path):
self.out_dir = out_dir
def transform(self, X, y=None):
output_paths = []
for x in X:
output_file = self.out_dir / Path(x).name
urlretrieve(x, output_file)
output_paths.append(str(output_file))
return output_paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment