Moxfield import fix
This commit is contained in:
@@ -53,8 +53,15 @@ async def resolve_card(
|
||||
if scry_id:
|
||||
url = f"https://api.scryfall.com/cards/{quote(scry_id)}"
|
||||
r = await _scryfall_get(client, url, slug)
|
||||
r.raise_for_status()
|
||||
return r.json()
|
||||
if r.status_code == 200:
|
||||
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:
|
||||
parsed = parse_scry_url(scry_url)
|
||||
|
||||
Reference in New Issue
Block a user