MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / download_file

Function download_file

utils/src/experiment/crawler.py:123–136  ·  view source on GitHub ↗
(
    session: aiohttp.ClientSession, filepath: str, url: str, pbar: tqdm = None
)

Source from the content-addressed store, hash-verified

121
122
123async def download_file(
124 session: aiohttp.ClientSession, filepath: str, url: str, pbar: tqdm = None
125) -> None:
126 os.makedirs(os.path.dirname(filepath), exist_ok=True)
127 async with session.get(
128 url, params={"access_token": os.environ["ZENODO_TOKEN"]}
129 ) as response:
130 if response.status == 200:
131 with open(filepath, "wb") as f:
132 f.write(await response.read())
133 elif response.status != 404:
134 raise Exception(f"Failed to download {filepath}: {response.status}")
135 if pbar is not None:
136 pbar.update(1)
137
138
139def collect_links(jsonl_file: str) -> None:

Callers 2

download_linksFunction · 0.70
gather_filesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected