Moxfield import fix

This commit is contained in:
2026-07-23 19:24:01 -05:00
parent f18c0c6564
commit b2a0b59cbe
+9 -2
View File
@@ -53,8 +53,15 @@ async def resolve_card(
if scry_id: if scry_id:
url = f"https://api.scryfall.com/cards/{quote(scry_id)}" url = f"https://api.scryfall.com/cards/{quote(scry_id)}"
r = await _scryfall_get(client, url, slug) r = await _scryfall_get(client, url, slug)
r.raise_for_status() if r.status_code == 200:
return r.json() return r.json()
if r.status_code != 404 or not name:
r.raise_for_status()
# Moxfield's scryfall_id can go stale (Scryfall periodically deletes/merges
# card ids when it corrects duplicate prints, e.g. basic lands and
# guildgates with many near-identical art variations). Fall back to a
# name lookup rather than failing the whole card.
db.add_log(slug, f" scryfall_id {scry_id} is stale (404) — falling back to name lookup")
if scry_url: if scry_url:
parsed = parse_scry_url(scry_url) parsed = parse_scry_url(scry_url)