2018-10-24 01:39:07 +00:00
|
|
|
|
import sys
|
|
|
|
|
sys.path.append('..')
|
|
|
|
|
from scrython.foundation import FoundationObject
|
2018-01-25 20:27:56 +00:00
|
|
|
|
import aiohttp
|
|
|
|
|
import asyncio
|
2018-02-14 02:02:48 +00:00
|
|
|
|
import urllib.parse
|
2018-03-01 02:04:45 +00:00
|
|
|
|
from threading import Thread
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-24 01:39:07 +00:00
|
|
|
|
class CardsObject(FoundationObject):
|
2018-10-22 14:19:38 +00:00
|
|
|
|
"""
|
|
|
|
|
Master class that all card objects inherit from.
|
|
|
|
|
|
2018-10-24 02:33:18 +00:00
|
|
|
|
Args:
|
|
|
|
|
format (string, optional):
|
|
|
|
|
Defaults to 'json'.
|
|
|
|
|
Returns data in the specified method.
|
|
|
|
|
face (string, optional):
|
|
|
|
|
Defaults to empty string.
|
|
|
|
|
If you're using the `image` format, this will specify if you want the front or back face.
|
|
|
|
|
version (string, optional):
|
|
|
|
|
Defaults to empty string.
|
|
|
|
|
If you're using the `image` format, this will specify if you want the small, normal,
|
|
|
|
|
large, etc version of the image.
|
|
|
|
|
pretty (string, optional):
|
|
|
|
|
Defaults to empty string.
|
|
|
|
|
Returns a prettier version of the json object.
|
|
|
|
|
Note that this may break functionality with Scrython.
|
|
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
|
Exception: If the object returned is an error.
|
2018-10-22 14:19:38 +00:00
|
|
|
|
"""
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def object(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""Returns the type of object it is
|
|
|
|
|
(card, error, etc)
|
|
|
|
|
|
|
|
|
|
Returns:
|
2018-10-24 02:33:18 +00:00
|
|
|
|
string
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('object')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['object']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def id(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""A unique ID for the returned card object
|
|
|
|
|
|
|
|
|
|
Returns:
|
2018-10-24 02:33:18 +00:00
|
|
|
|
string
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('id')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['id']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def multiverse_ids(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""The official Gatherer multiverse ids of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
2018-10-24 02:33:18 +00:00
|
|
|
|
list
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('multiverse_ids')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['multiverse_ids']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def mtgo_id(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""The official MTGO id of the of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
integer: The Magic Online id of the card
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('mtgo_id')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['mtgo_id']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def mtgo_foil_id(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""The corresponding MTGO foil ID of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
integer: The Magic Online foil id of the card
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('mtgo_foil_id')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['mtgo_foil_id']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2019-04-01 16:53:29 +00:00
|
|
|
|
def tcgplayer_id(self):
|
|
|
|
|
"""The `productId` of the card on TCGplayer.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
integer: The TCGplayer id of the card
|
|
|
|
|
"""
|
|
|
|
|
super(CardsObject, self)._checkForKey('tcgplayer_id')
|
|
|
|
|
|
|
|
|
|
return self.scryfallJson['tcgplayer_id']
|
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def name(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""The oracle name of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
2018-10-24 02:33:18 +00:00
|
|
|
|
string
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('name')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['name']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def uri(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""The Scryfall API uri for the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
2018-10-24 02:33:18 +00:00
|
|
|
|
string
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('uri')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['uri']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def scryfall_uri(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""The full Scryfall page of the card
|
|
|
|
|
As if it was a URL from the site.
|
|
|
|
|
|
|
|
|
|
Returns:
|
2018-10-24 02:33:18 +00:00
|
|
|
|
string
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('scryfall_uri')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['scryfall_uri']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def layout(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""The image layout of the card. (normal, transform, etc)
|
|
|
|
|
|
|
|
|
|
Returns:
|
2018-10-24 02:33:18 +00:00
|
|
|
|
string
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('layout')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['layout']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def highres_image(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""Determine if a card has a highres scan available
|
|
|
|
|
|
|
|
|
|
Returns:
|
2018-10-24 02:33:18 +00:00
|
|
|
|
boolean
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('highres_image')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['highres_image']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-30 17:13:09 +00:00
|
|
|
|
def image_uris(self, index=0, image_type=None):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""All image uris of the card in various qualities
|
2018-10-30 17:13:09 +00:00
|
|
|
|
|
|
|
|
|
An index and an image type must be supplied a single uri.
|
|
|
|
|
|
|
|
|
|
If the card has additional faces, the returned dict will
|
|
|
|
|
default to the front of the card.
|
|
|
|
|
|
2018-10-24 00:54:28 +00:00
|
|
|
|
Returns:
|
2018-10-30 17:13:09 +00:00
|
|
|
|
dict: If given no arguments
|
|
|
|
|
string: If given an index and image_type
|
|
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
|
Exception: If given no index
|
|
|
|
|
KeyError: If the given image type is not a known type
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-29 21:18:38 +00:00
|
|
|
|
layouts = {
|
|
|
|
|
'normal': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'split': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'flip': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'transform': lambda num: self.scryfallJson['card_faces'][num]['image_uris'],
|
|
|
|
|
'meld': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'leveler': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'saga': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'planar': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'scheme': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'vanguard': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'token': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'double_faced_token': lambda num: self.scryfallJson['card_faces'][num]['image_uris'],
|
|
|
|
|
'emblem': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'augment': lambda num: self.scryfallJson['image_uris'],
|
2019-09-22 04:50:12 +00:00
|
|
|
|
'host': lambda num: self.scryfallJson['image_uris'],
|
|
|
|
|
'adventure': lambda num: self.scryfallJson['image_uris']
|
2018-10-29 21:18:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
image_types = {
|
|
|
|
|
'small': lambda d: d['small'],
|
|
|
|
|
'normal': lambda d: d['normal'],
|
|
|
|
|
'large': lambda d: d['large'],
|
|
|
|
|
'png': lambda d: d['png'],
|
|
|
|
|
'art_crop': lambda d: d['art_crop'],
|
|
|
|
|
'border_crop': lambda d: d['border_crop']
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
images_dict = layouts.get(self.scryfallJson['layout'])
|
|
|
|
|
|
2018-10-30 17:13:09 +00:00
|
|
|
|
uri = image_types.get(image_type)
|
2018-10-29 21:18:38 +00:00
|
|
|
|
|
2018-10-30 17:13:09 +00:00
|
|
|
|
if index == 0 and image_type is None:
|
|
|
|
|
return images_dict(0)
|
|
|
|
|
elif not isinstance(index, int):
|
|
|
|
|
raise Exception('You must supply an index to get a uri')
|
|
|
|
|
elif image_type not in list(image_types.keys()):
|
|
|
|
|
raise KeyError('Image type not in known types')
|
|
|
|
|
|
|
|
|
|
return uri(images_dict(index))
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def cmc(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""A float of the converted mana cost of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
float: The cmc of the card
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('cmc')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['cmc']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def type_line(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The full type line of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('type_line')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['type_line']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def oracle_text(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The official oracle text of a card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('oracle_text')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['oracle_text']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def mana_cost(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The full mana cost using shorthanded mana symbols
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('mana_cost')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['mana_cost']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def colors(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""A list of strings with all colors found in the mana cost
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
list
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('colors')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['colors']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def color_identity(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""A list of strings with all colors found on the card itself
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
list
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('color_identity')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['color_identity']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def legalities(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""A dictionary of all formats and their legality
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
dict
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('legalities')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['legalities']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def reserved(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""Returns True if the card is on the reserved list
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
boolean
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('reserved')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['reserved']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def reprint(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""Returns True if the card has been reprinted before
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
boolean
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('reprint')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['reprint']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def set_code(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The 3 letter code for the set of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('set')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['set']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def set_name(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The full name for the set of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('set_name')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['set_name']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def set_uri(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The API uri for the full set list of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('set_uri')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['set_uri']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def set_search_uri(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""Same output as set_uri
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('set_search_uri')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['set_search_uri']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def scryfall_set_uri(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The full link to the set on Scryfall
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('scryfall_set_uri')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['scryfall_set_uri']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def rulings_uri(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The API uri for the rulings of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('rulings_uri')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['rulings_uri']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def prints_search_uri(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""A link to where you can begin paginating all re/prints for this card on Scryfall’s API
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('prints_search_uri')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['prints_search_uri']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def collector_number(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The collector number of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('collector_number')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['collector_number']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def digital(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""Returns True if the card is the digital version
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
boolean
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('digital')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['digital']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def rarity(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The rarity of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('rarity')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['rarity']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def illustration_id(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The related id of the card art
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('illustration_id')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['illustration_id']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def artist(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The artist of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('artist')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['artist']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def frame(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The year of the card frame
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('frame')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['frame']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2019-04-01 16:53:29 +00:00
|
|
|
|
def frame_effect(self):
|
|
|
|
|
"""The card's frame effect, if any. (miracle, nyxtouched, etc.)
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string: The card's frame effect.
|
|
|
|
|
"""
|
|
|
|
|
super(CardsObject, self)._checkForKey('frame_effect')
|
|
|
|
|
|
|
|
|
|
return self.scryfallJson['frame_effect']
|
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def full_art(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""Returns True if the card is considered full art
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
boolean
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('full_art')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['full_art']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def border_color(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The color of the card border
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('border_color')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['border_color']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def edhrec_rank(self):
|
2018-10-24 03:28:25 +00:00
|
|
|
|
"""The rank of the card on edhrec.com
|
2018-10-24 02:33:18 +00:00
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
int: The rank of the card on edhrec.co
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('edhrec_rank')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['edhrec_rank']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2019-04-01 16:53:29 +00:00
|
|
|
|
def prices(self, mode):
|
|
|
|
|
"""Returns prices from modes `usd`, `usd_foil`, `eur`, and `tix`
|
2018-10-24 02:33:18 +00:00
|
|
|
|
|
|
|
|
|
Args:
|
2019-04-01 16:53:29 +00:00
|
|
|
|
mode (string): The prices to get
|
2018-10-24 02:33:18 +00:00
|
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
|
KeyError: If the mode parameter does not match a known key
|
|
|
|
|
|
|
|
|
|
Returns:
|
2019-04-01 16:53:29 +00:00
|
|
|
|
float: The prices as a float
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
modes = ['usd', 'eur', 'tix']
|
|
|
|
|
if mode not in modes:
|
|
|
|
|
raise KeyError("{} is not a key.".format(mode))
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey(mode)
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson[mode]
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def related_uris(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""A dictionary of related websites for this card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
dict
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('related_uris')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['related_uris']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def purchase_uris(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""A dictionary of links to purchase the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
dict
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('purchase_uris')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['purchase_uris']
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def life_modifier(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""This is the cards life modifier value, assuming it's a Vanguard card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('life_modifier')
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['life_modifier']
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def hand_modifier(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""This cards hand modifier value, assuming it's a Vanguard card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('hand_modifier')
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['hand_modifier']
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-23 04:36:27 +00:00
|
|
|
|
def color_indicator(self, num):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""An list of all colors found in this card's color indicator
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
list
|
|
|
|
|
"""
|
2018-10-23 04:36:27 +00:00
|
|
|
|
self._checkForTupleKey('card_faces', num, 'color_indicator')
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-23 04:36:27 +00:00
|
|
|
|
return self.scryfallJson['card_faces'][num]['color_indicator']
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def all_parts(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""This this card is closely related to other cards, this property will be an list with it
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
list
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('all_parts')
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['all_parts']
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def card_faces(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""If it exists, all parts found on a card's face will be found as an object from this list
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
list
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('card_faces')
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['card_faces']
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def watermark(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The associated watermark of the card, if any
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('watermark')
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['watermark']
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:55:26 +00:00
|
|
|
|
def story_spotlight(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""True if this card is featured in the story
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
boolean
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('story_spotlight')
|
2018-01-30 15:18:47 +00:00
|
|
|
|
|
2018-10-22 14:55:26 +00:00
|
|
|
|
return self.scryfallJson['story_spotlight']
|
2018-02-26 23:19:00 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def power(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The power of the creature, if applicable
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('power')
|
2018-02-28 03:42:34 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['power']
|
2018-02-28 03:42:34 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def toughness(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The toughness of the creature, if applicable
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('toughness')
|
2018-02-28 03:42:34 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['toughness']
|
2018-02-28 03:42:34 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def loyalty(self):
|
2018-10-24 03:28:25 +00:00
|
|
|
|
"""This card's loyalty. Some loyalties may be X rather than a number
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('loyalty')
|
2018-02-28 03:42:34 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['loyalty']
|
2018-02-28 03:42:34 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def flavor_text(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The flavor text of the card, if any
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('flavor_text')
|
2018-02-28 03:42:34 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['flavor_text']
|
2018-06-13 17:37:44 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def arena_id(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The Arena ID of the card, if any
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
int: The Arena ID of the card, if any
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('arena_id')
|
2018-06-13 17:37:44 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['arena_id']
|
2018-06-13 17:44:26 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def lang(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""The language of the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('lang')
|
2018-06-13 17:44:26 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['lang']
|
2018-06-13 18:01:12 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def printed_name(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""If the card is in a non-English language, this will be the name as it appears on the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('printed_name')
|
2018-06-13 18:01:12 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['printed_name']
|
2018-06-13 18:01:12 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def printed_type_line(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""If the card is in a non-English language, this will be the type line as it appears on the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('printed_type_line')
|
2018-06-13 18:01:12 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['printed_type_line']
|
2018-06-13 18:01:12 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def printed_text(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""If the card is in a non-English language, this will be the rules text as it appears on the card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('printed_text')
|
2018-06-13 18:01:12 +00:00
|
|
|
|
|
2018-10-22 14:55:26 +00:00
|
|
|
|
return self.scryfallJson['printed_text']
|
|
|
|
|
|
|
|
|
|
def oracle_id(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""A unique ID for this card's oracle text
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('oracle_id')
|
2018-10-22 14:55:26 +00:00
|
|
|
|
|
|
|
|
|
return self.scryfallJson['oracle_id']
|
|
|
|
|
|
2018-10-23 04:36:27 +00:00
|
|
|
|
def foil(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""True if this printing exists in a foil version
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
boolean
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('foil')
|
2018-10-22 14:55:26 +00:00
|
|
|
|
|
2018-10-23 04:36:27 +00:00
|
|
|
|
return self.scryfallJson['foil']
|
|
|
|
|
|
|
|
|
|
def nonfoil(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""True if this printing does not exist in foil
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
boolean
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('nonfoil')
|
2018-10-23 04:36:27 +00:00
|
|
|
|
|
2018-10-22 14:55:26 +00:00
|
|
|
|
return self.scryfallJson['nonfoil']
|
|
|
|
|
|
|
|
|
|
def oversized(self):
|
2018-10-24 02:33:18 +00:00
|
|
|
|
"""True if this printing is an oversized card
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
boolean
|
|
|
|
|
"""
|
2018-10-24 01:39:07 +00:00
|
|
|
|
super(CardsObject, self)._checkForKey('oversized')
|
2018-10-22 14:55:26 +00:00
|
|
|
|
|
2018-10-29 21:18:38 +00:00
|
|
|
|
return self.scryfallJson['oversized']
|
2019-04-01 16:53:29 +00:00
|
|
|
|
|
|
|
|
|
def games(self):
|
|
|
|
|
"""A list of games that this card print is available in.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
array: A list of games
|
|
|
|
|
"""
|
|
|
|
|
super(CardsObject, self)._checkForKey('games')
|
|
|
|
|
|
|
|
|
|
return self.scryfallJson['games']
|
|
|
|
|
|
|
|
|
|
def promo(self):
|
|
|
|
|
"""True if this card is a promotional print.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
boolean
|
|
|
|
|
"""
|
|
|
|
|
super(CardsObject, self)._checkForKey('promo')
|
|
|
|
|
|
|
|
|
|
return self.scryfallJson['promo']
|
|
|
|
|
|
|
|
|
|
def released_at(self):
|
|
|
|
|
"""The date this card was first released.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
string: The date in ISO format
|
|
|
|
|
"""
|
|
|
|
|
super(CardsObject, self)._checkForKey('released_at')
|
|
|
|
|
|
|
|
|
|
return self.scryfallJson['released_at']
|