Skip to content

Instantly share code, notes, and snippets.

@MartinEls
Last active February 24, 2023 17:39
Show Gist options
  • Save MartinEls/70751345ec55893cf6cffffa8591ca35 to your computer and use it in GitHub Desktop.
Save MartinEls/70751345ec55893cf6cffffa8591ca35 to your computer and use it in GitHub Desktop.
ZINC20 download
import os
import requests
from tqdm import tqdm
def download(zinc20_url):
tranch = (zinc20_url.split('/')[-1]).split('.')[0]
r = requests.get(zinc20_url.strip())
with open('all_tranches/' + tranch + '.tsv', 'wb') as f:
f.write(r.content)
if __name__ == '__main__':
with open('ZINC-downloader-2D-txt.uri', 'r') as f:
urls = f.readlines()
for url in tqdm(urls):
try:
download(url)
except:
print(f'Downloading from {url} failed')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment