Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions foldcomp/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
async def get_size(client, url):
response = await client.head(url=url)
if response.status_code == 200:
return int(response.headers["content-length"])
return int(response.headers["Content-Length"])
else:
return -1

Expand Down Expand Up @@ -34,9 +34,8 @@ async def download_range(client, url, start, end, output, mode):


async def download(url, output, chunks=16):
async with httpx.AsyncClient() as client:
async with httpx.AsyncClient(follow_redirects=True) as client:
file_size = await get_size(client, url)

if file_size == -1:
return

Expand Down Expand Up @@ -79,7 +78,7 @@ async def download(url, output, chunks=16):


async def download_json(url):
async with httpx.AsyncClient() as client:
async with httpx.AsyncClient(follow_redirects=True) as client:
response = await client.get(url)
return response.json()

Expand All @@ -92,7 +91,7 @@ def setup(db="afdb_swissprot", download_chunks=16):
for i in ["", ".index", ".dbtype", ".lookup", ".source"]:
asyncio.run(
download(
f"https://steineggerlab.s3.amazonaws.com/foldcomp/{db}{i}",
f"https://foldcomp.steineggerlab.workers.dev/{db}{i}",
f"{db}{i}",
chunks=download_chunks,
)
Expand All @@ -102,7 +101,7 @@ def setup(db="afdb_swissprot", download_chunks=16):
async def setup_async(db="afdb_swissprot", download_chunks=16):
for i in ["", ".index", ".dbtype", ".lookup", ".source"]:
await download(
f"https://steineggerlab.s3.amazonaws.com/foldcomp/{db}{i}",
f"https://foldcomp.steineggerlab.workers.dev/{db}{i}",
f"{db}{i}",
chunks=download_chunks,
)
Loading