Esempio n. 1
0
 def test_get_mtga_card(self, mtga_id, expected_card_name):
     """Test fetching cards from Scryfall using arena ids"""
     try:
         card = scryfall.get_mtga_card(mtga_id)
         self.assertEqual(card.pretty_name, expected_card_name)
     except Exception as exception:
         self.assertIsInstance(exception, expected_card_name)
Esempio n. 2
0
 def _fetch_card_from_scryfall(self, mtga_id):
     if not self.fallback:
         return None
     try:
         card = scryfall.get_mtga_card(mtga_id)
     except Exception as scryfall_error:
         card = scryfall.ScryfallError(scryfall_error)
     return card
Esempio n. 3
0
 def get_collection(self):
     collection = self.get_last_json_block('<== ' + MTGA_COLLECTION_KEYWORD)
     for (id, count) in iteritems(collection):
         try:
             card = all_mtga_cards.find_one(id)
             yield [card, count]
         except ValueError as exception:
             yield MtgaUnknownCard(exception)
             #Card not found, try to get it from scryfall
             try:
                 card = scryfall.get_mtga_card(id)
                 yield [card, count]
             except Exception as scryfall_error:
                 yield scryfall.ScryfallError(scryfall_error)