Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/mavedb/lib/external_publications.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,4 +564,5 @@ def _fetch(self, url: str, return_format: str = "json") -> Any:
return []

response.raise_for_status()

return json.loads(response.text) if return_format == "json" else response.text
16 changes: 15 additions & 1 deletion src/mavedb/lib/identifiers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json
import logging
import os
from typing import Mapping, Optional, Union

Expand All @@ -23,6 +25,8 @@
from mavedb.models.uniprot_identifier import UniprotIdentifier
from mavedb.models.uniprot_offset import UniprotOffset

logger = logging.getLogger(__name__)

# XXX these classes all have an "identifier" attribute but there's no superclass
# to unify them ...

Expand Down Expand Up @@ -322,7 +326,17 @@ async def find_generic_article(
).scalar_one_or_none()

if not existing_publication:
external_publication = await db_specific_fetches[publication_db](identifier)
try:
external_publication = await db_specific_fetches[publication_db](identifier)
except json.JSONDecodeError:
logger.warning(
"Failed to fetch identifier %r from %s while fanning out over candidate databases.",
identifier,
publication_db,
exc_info=True,
)
external_publication = None

found_articles[publication_db] = (
ExternalPublication(identifier, publication_db, external_publication)
if external_publication
Expand Down
Loading