From 42db37c69eb812f10bd009da5c10a2dd9d33c994 Mon Sep 17 00:00:00 2001 From: Nanda Scott Date: Wed, 10 Jan 2018 22:50:10 -0500 Subject: [PATCH] Added currency attribute to randomcard. --- cards/randomcard.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cards/randomcard.py b/cards/randomcard.py index 1c79f09..c2624ed 100644 --- a/cards/randomcard.py +++ b/cards/randomcard.py @@ -53,7 +53,7 @@ class RandomCard(object): colorshifted: bool Returns True if the card is colorshifted. futureshifted: bool Returns True if the card is futureshifted. edhrec_rank: int The rank of the card on edhrec.com - tix: int The MTGO price of the card + currency: str The various currencies of the card. Modes are usd, eur, tix. related_uris: dict A dictionary of related websites for this card. purchase_uris: dict A dictionary of links to purchase the card. """ @@ -202,8 +202,11 @@ class RandomCard(object): def edhrec_rank(self): return self.scryfallJson['edhrec_rank'] - def tix(self): - return self.scryfallJson['tix'] + def currency(self, mode): + modes = ['usd', 'eur', 'tix'] + if mode not in modes: + return KeyError("That currency is not available.") + return self.scryfallJson[mode] def related_uris(self): return self.scryfallJson['related_uris']