Skip to content

Commit

Permalink
ClinVar: Don't record official warning when getting single 400 from E…
Browse files Browse the repository at this point in the history
…ntrez
  • Loading branch information
TheMadBug committed Aug 17, 2023
1 parent 19eeb47 commit deb41f1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions annotation/clinvar_xml_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io
import logging
from dataclasses import dataclass, field
from datetime import timedelta, datetime
from urllib.error import HTTPError
Expand Down Expand Up @@ -83,8 +84,8 @@ def fetch(self) -> ClinVarRecordCollection:
allele_id = va.allele_id
clinvar_record_collection.allele_id = allele_id

# if not allele_id:
# raise ValueError(f"Couldn't determine Allele for clinvar_variation_id {self.clinvar_variation_id}")
if not allele_id:
raise ValueError(f"Couldn't determine Allele for clinvar_variation_id {self.clinvar_variation_id}")

if fetch_from_clinvar:
# so while Entrez does automatically retry on 500s, ClinVar has been providing 400s (Bad Request) when
Expand All @@ -107,7 +108,7 @@ def fetch(self) -> ClinVarRecordCollection:
if http_ex.code == 400:
attempt_count -= 1
if attempt_count > 0:
report_message(f"400 from Entrez when fetching ClinVarRecord, waiting then trying again", level='warning')
logging.warning(f"400 from Entrez when fetching ClinVarRecord, waiting then trying again")
time.sleep(10)
continue
# out of attempts or not 400
Expand Down

0 comments on commit deb41f1

Please sign in to comment.