Skip to content

Commit

Permalink
Refactor downloader to class
Browse files Browse the repository at this point in the history
  • Loading branch information
zmughal committed Mar 6, 2024
1 parent 9a30afc commit de72c13
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions biobricks/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
from pathlib import Path
from tqdm import tqdm # Import tqdm for the progress bar

from dataclasses import dataclass, field

@dataclass
class Downloader:
remote_url_prefix: str = field(default = 'https://dvc.biobricks.ai/files/md5/')

def _md5_to_remote_url( self, md5 ):
return self.remote_url_prefix + md5[:2] + "/" + md5[2:]

def _download_outdir(url, dest_path: Path):
with requests.get(url, headers={'BBToken': token()}, stream=True) as r:
r.raise_for_status()
Expand Down

0 comments on commit de72c13

Please sign in to comment.