Skip to content

Commit

Permalink
Add a pause to avoid rate limits
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh committed Sep 5, 2024
1 parent a044180 commit 932cb38
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/kg_bioportal/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import logging
import os
import time

import requests

ONTOLOGY_LIST_NAME = "ontologylist.tsv"
Expand Down Expand Up @@ -158,5 +160,7 @@ def get_ontology_list(self) -> None:
outfile.write(
f"{acronym}\t{name}\t{current_version}\t{submission_id}\n"
)
# Wait for half a second to avoid rate limiting
time.sleep(0.5)

logging.info(f"Wrote to {self.output_dir}/{ONTOLOGY_LIST_NAME}")

0 comments on commit 932cb38

Please sign in to comment.