Skip to content

Commit

Permalink
Added sleep call
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTatarnikov committed Oct 23, 2024
1 parent 1cb2e9d commit 98c5679
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
from time import sleep

import pandas as pd
import requests
Expand Down Expand Up @@ -89,6 +90,7 @@ def get_gene_experiments(self, gene):
url = self.gene_experiments_url.replace("-GENE_SYMBOL-", gene)
max_retries = 8
delay = 4
data = None

for i in range(max_retries):
try:
Expand All @@ -97,6 +99,7 @@ def get_gene_experiments(self, gene):
except requests.exceptions.JSONDecodeError:
print(f"Unable to connect to Allen API, retrying in {delay}")
delay *= 2
sleep(delay)

Check warning on line 102 in brainrender/atlas_specific/allen_brain_atlas/gene_expression/api.py

View check run for this annotation

Codecov / codecov/patch

brainrender/atlas_specific/allen_brain_atlas/gene_expression/api.py#L99-L102

Added lines #L99 - L102 were not covered by tests

if not len(data):
print(f"No experiment found for gene {gene}")
Expand Down

0 comments on commit 98c5679

Please sign in to comment.