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-02-07 03:01:08 +00:00
|
|
|
|
class CardsObject(object):
|
2018-10-22 14:19:38 +00:00
|
|
|
|
"""
|
|
|
|
|
Master class that all card objects inherit from.
|
|
|
|
|
|
|
|
|
|
Positional arguments:
|
|
|
|
|
No positional arguments are required.
|
|
|
|
|
|
|
|
|
|
Optional arguments:
|
|
|
|
|
format : str ... Returns data in the specified method. Defaults to JSON.
|
|
|
|
|
face : str ... If you're using the `image` format, this will specify if
|
|
|
|
|
you want the front or back face.
|
|
|
|
|
version : str ... If you're using the `image` format, this will specify if
|
|
|
|
|
you want the small, normal, large, etc version of the image.
|
|
|
|
|
pretty : str ... Returns a prettier version of the json object. Note that
|
|
|
|
|
this may break functionality with Scrython.
|
|
|
|
|
Attributes:
|
|
|
|
|
type_line : str ....................... The full type line of the card.
|
|
|
|
|
oracle_text : str ................. The official oracle text of a card.
|
|
|
|
|
mana_cost : str .... The full mana cost using shorthanded mana symbols.
|
|
|
|
|
colors : list ... An array of strings with all colors found in the mana cost.
|
|
|
|
|
color_identity : list ... An array of strings with all colors found on the card itself.
|
|
|
|
|
legalities : dict ..... A dictionary of all formats and their legality.
|
|
|
|
|
reserved : bool ..... Returns True if the card is on the reserved list.
|
|
|
|
|
reprint : bool .... Returns True if the card has been reprinted before.
|
|
|
|
|
set_code : str ............. The 3 letter code for the set of the card.
|
|
|
|
|
set_name : str ................. The full name for the set of the card.
|
|
|
|
|
set_uri : str .......... The API uri for the full set list of the card.
|
|
|
|
|
set_search_uri : str .......................... Same output as set_uri.
|
|
|
|
|
scryfall_set_uri : str .......... The full link to the set on Scryfall.
|
|
|
|
|
rulings_uri : str ............ The API uri for the rulings of the card.
|
|
|
|
|
prints_search_uri : str ... A link to where you can begin paginating all re/prints for this card on Scryfall’s API.
|
|
|
|
|
collector_number : str .............. The collector number of the card.
|
|
|
|
|
digital : bool ....... Returns True if the card is the digital version.
|
|
|
|
|
rarity : str .................................. The rarity of the card.
|
|
|
|
|
illuStringation_id : str .............. The related id of the card art.
|
|
|
|
|
artist : str .................................. The artist of the card.
|
|
|
|
|
frame : str ............................... The year of the card frame.
|
|
|
|
|
full_art : bool ...... Returns True if the card is considered full art.
|
|
|
|
|
border_color : str ...................... The color of the card border.
|
|
|
|
|
timeshifted : bool ........... Returns True if the card is timeshifted.
|
|
|
|
|
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
|
|
|
|
|
currency("<mode>")` : str ... Returns currency from modes `usd`, `eur`, and `tix`.
|
|
|
|
|
related_uris : dict ... A dictionary of related websites for this card.
|
|
|
|
|
purchase_uris : dict ...... A dictionary of links to purchase the card.
|
|
|
|
|
life_modifier : str ... This is the cards life modifier value, assuming it's a Vanguard card.
|
|
|
|
|
hand_modifier : str ... This cards hand modifier value, assuming it's a Vanguard card.
|
|
|
|
|
color_indicator : list ... An array of all colors found in this card's color indicator.
|
|
|
|
|
all_parts : list ... This this card is closely related to other cards, this property will be an array with it.
|
|
|
|
|
card_faces : list ... If it exists, all parts found on a card's face will be found as an object from this array.
|
|
|
|
|
watermark : str ......... The associated watermark of the card, if any.
|
2018-10-22 14:55:26 +00:00
|
|
|
|
story_spotlight : bool .... True if this card is featured in the story.
|
2018-10-22 14:19:38 +00:00
|
|
|
|
power : str ................. The power of the creature, if applicable.
|
|
|
|
|
toughness : str ......... The toughness of the creature, if applicable.
|
|
|
|
|
flavor_text : str ................ The flavor text of the card, if any.
|
|
|
|
|
arena_id : int ...................... The Arena ID of the card, if any.
|
|
|
|
|
lang : str ... The language of the card.
|
|
|
|
|
printed_name : str .. If the card is in a non-English language, this will be the name as it appears on the card.
|
|
|
|
|
printed_type_line : str .. If the card is in a non-English language, this will be the type line as it appears on the card.
|
|
|
|
|
printed_text : str ... If the card is in a non-English language, this will be the rules text as it appears on the card.
|
2018-10-22 14:55:26 +00:00
|
|
|
|
oracle_id : str .............. A unique ID for this card's oracle text.
|
|
|
|
|
foil : bool ........... True if this printing exists in a foil version.
|
|
|
|
|
loyalty : str .... This card's loyalty. Some loyalties may be X rather than a number.
|
|
|
|
|
non_foil : bool ......... True if this printing does not exist in foil.
|
|
|
|
|
oversized : bool .......... True if this printing is an oversized card.
|
2018-10-22 14:19:38 +00:00
|
|
|
|
"""
|
|
|
|
|
def __init__(self, _url, **kwargs):
|
|
|
|
|
|
|
|
|
|
self.params = {
|
|
|
|
|
'format': kwargs.get('format', 'json'), 'face': kwargs.get('face', ''),
|
|
|
|
|
'version': kwargs.get('version', ''), 'pretty': kwargs.get('pretty', '')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.encodedParams = urllib.parse.urlencode(self.params)
|
|
|
|
|
self._url = 'https://api.scryfall.com/{0}&{1}'.format(_url, self.encodedParams)
|
|
|
|
|
|
|
|
|
|
async def getRequest(client, url, **kwargs):
|
|
|
|
|
async with client.get(url, **kwargs) as response:
|
|
|
|
|
return await response.json()
|
|
|
|
|
|
|
|
|
|
async def main(loop):
|
|
|
|
|
async with aiohttp.ClientSession(loop=loop) as client:
|
|
|
|
|
self.scryfallJson = await getRequest(client, self._url)
|
|
|
|
|
|
|
|
|
|
def do_everything():
|
|
|
|
|
loop = asyncio.new_event_loop()
|
|
|
|
|
asyncio.set_event_loop(loop)
|
|
|
|
|
loop.run_until_complete(main(loop))
|
|
|
|
|
|
|
|
|
|
t = Thread(target=do_everything)
|
|
|
|
|
t.run()
|
|
|
|
|
|
|
|
|
|
if self.scryfallJson['object'] == 'error':
|
|
|
|
|
raise Exception(self.scryfallJson['details'])
|
|
|
|
|
|
|
|
|
|
def _checkForKey(self, key):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""Checks for a key in the scryfallJson object.
|
|
|
|
|
This function should be considered private, and
|
|
|
|
|
should not be accessed in production.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
key (string): The key to check
|
|
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
|
KeyError: If key is not found.
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
if not key in self.scryfallJson:
|
|
|
|
|
raise KeyError('This card has no key \'{}\''.format(key))
|
|
|
|
|
|
|
|
|
|
def _checkForTupleKey(self, parent, num, key):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""Checks for a key of an object in an array.
|
|
|
|
|
This function should be considered private, and
|
|
|
|
|
should not be accessed in production.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
parent (string): The key for the array to be accessed
|
|
|
|
|
num (int): The index of the array
|
|
|
|
|
key (string): The key to check
|
|
|
|
|
|
|
|
|
|
Raises:
|
|
|
|
|
KeyError: If key is not found.
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
if not key in self.scryfallJson[parent][num]:
|
|
|
|
|
raise KeyError('This tuple has no key \'{}\''.format(key))
|
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:
|
|
|
|
|
string: The type of object
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
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:
|
|
|
|
|
string: The scryfall id of the card
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
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:
|
|
|
|
|
list: The associated multiverse ids of the card
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
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-22 14:19:38 +00:00
|
|
|
|
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-22 14:19:38 +00:00
|
|
|
|
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
|
|
|
|
|
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:
|
|
|
|
|
string: The card name
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
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:
|
|
|
|
|
string: An API uri for the card
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
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:
|
|
|
|
|
string: The Scryfall URL for the card
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
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:
|
|
|
|
|
string: The card layout
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
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:
|
|
|
|
|
boolean: True if card has a highres image available
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
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-22 14:19:38 +00:00
|
|
|
|
def image_uris(self):
|
2018-10-24 00:54:28 +00:00
|
|
|
|
"""All image uris of the card in various qualities
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
dict: The dictionary of image uris
|
|
|
|
|
"""
|
2018-10-22 14:19:38 +00:00
|
|
|
|
self._checkForKey('image_uris')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['image_uris']
|
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-22 14:19:38 +00:00
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def full_art(self):
|
2018-10-23 04:36:27 +00:00
|
|
|
|
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):
|
|
|
|
|
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 timeshifted(self):
|
|
|
|
|
self._checkForKey('timeshifted')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['timeshifted']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def colorshifted(self):
|
|
|
|
|
self._checkForKey('colorshifted')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['colorshifted']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def futureshifted(self):
|
|
|
|
|
self._checkForKey('futureshifted')
|
2018-01-30 04:43:36 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
return self.scryfallJson['futureshifted']
|
2018-01-25 20:27:56 +00:00
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def edhrec_rank(self):
|
|
|
|
|
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
|
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
|
def currency(self, mode):
|
|
|
|
|
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-22 14:19:38 +00:00
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
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):
|
|
|
|
|
self._checkForKey('oracle_id')
|
|
|
|
|
|
|
|
|
|
return self.scryfallJson['oracle_id']
|
|
|
|
|
|
2018-10-23 04:36:27 +00:00
|
|
|
|
def foil(self):
|
2018-10-22 14:55:26 +00:00
|
|
|
|
self._checkForKey('foil')
|
|
|
|
|
|
2018-10-23 04:36:27 +00:00
|
|
|
|
return self.scryfallJson['foil']
|
|
|
|
|
|
|
|
|
|
def nonfoil(self):
|
|
|
|
|
self._checkForKey('nonfoil')
|
|
|
|
|
|
2018-10-22 14:55:26 +00:00
|
|
|
|
return self.scryfallJson['nonfoil']
|
|
|
|
|
|
|
|
|
|
def oversized(self):
|
|
|
|
|
self._checkForKey('oversized')
|
|
|
|
|
|
|
|
|
|
return self.scryfallJson['oversized']
|