2018-02-13 21:35:01 +00:00
|
|
|
from .cards_object import CardsObject
|
|
|
|
import urllib.parse
|
2018-01-10 21:55:11 +00:00
|
|
|
|
2018-02-13 21:35:01 +00:00
|
|
|
class Autocomplete(CardsObject):
|
2018-10-22 14:19:38 +00:00
|
|
|
"""
|
|
|
|
cards/autocomplete
|
|
|
|
Get a list of potential autocompletion phrases.
|
2018-02-21 19:42:58 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
Positional arguments:
|
|
|
|
q : str ........... The query of the autocompletion.
|
2018-02-21 19:42:58 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
Optional arguments:
|
|
|
|
Inherits arguments from CardsObject.
|
2018-02-21 19:42:58 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
Attributes:
|
|
|
|
object : str ........ Returns what kind of object it is.
|
|
|
|
total_items : int ...... How many items are in the list.
|
|
|
|
data : list ....... The list of potential autocompletes.
|
2018-02-21 19:42:58 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
Example usage:
|
|
|
|
>>> auto = scrython.cards.Autocomplete(q="Thal")
|
|
|
|
>>> auto.total_items()
|
|
|
|
"""
|
|
|
|
def __init__(self, **kwargs):
|
|
|
|
if kwargs.get('q') is None:
|
|
|
|
raise TypeError('No query provided to search by')
|
2018-02-13 21:51:03 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
self.dict = {
|
|
|
|
'q': kwargs.get('q'),
|
|
|
|
'pretty': kwargs.get('pretty', 'false'),
|
|
|
|
'format': kwargs.get('format', 'json')
|
|
|
|
}
|
2018-01-10 21:55:11 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
self.args = urllib.parse.urlencode(self.dict)
|
|
|
|
self.url = 'cards/autocomplete?' + self.args
|
|
|
|
super(Autocomplete, self).__init__(self.url)
|
2018-01-10 21:55:11 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def object(self):
|
|
|
|
super(Autocomplete, self)._checkForKey('object')
|
2018-01-30 15:30:14 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
return self.scryfallJson['object']
|
2018-01-10 21:55:11 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def total_items(self):
|
|
|
|
super(Autocomplete, self)._checkForKey('total_items')
|
2018-01-30 15:30:14 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
return self.scryfallJson['total_items']
|
2018-01-10 21:55:11 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def data(self):
|
|
|
|
super(Autocomplete, self)._checkForKey('data')
|
2018-01-30 15:30:14 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
return self.scryfallJson['data']
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
#The following attributes are only to override the inherited class attributes.
|
|
|
|
#This class has no matching attributes but we still need the getRequest function from CardsObject
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def id(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'id\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def multiverse_ids(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'multiverse_ids\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def mtgo_id(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'mtgo_id\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def mtgo_foil_id(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'mtgo_foil_id\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def name(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'name\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def uri(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'uri\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def scryfall_uri(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'scryfall_uri\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def layout(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'layout\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def highres_image(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'highres_image\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def image_uris(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'image_uris\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def cmc(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'cmc\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def type_line(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'type_line\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def oracle_text(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'oracle_text\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def mana_cost(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'mana_cost\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def colors(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'colors\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def color_identity(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'color_identity\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def legalities(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'legalities\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def reserved(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'reserved\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def reprint(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'reprint\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def set_code(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'set_code\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def set_name(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'set_name\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def set_uri(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'set_uri\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def set_search_uri(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'set_search_uri\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def scryfall_set_uri(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'scryfall_set_uri\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def rulings_uri(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'rulings_uri\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def prints_search_uri(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'prints_search_uri\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def collector_number(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'collector_number\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def digital(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'digital\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def rarity(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'rarity\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def illustration_id(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'illustration_id\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def artist(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'artist\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def frame(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'frame\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def full_art(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'full_art\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def border_color(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'border_color\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def timeshifted(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'timeshifted\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def colorshifted(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'colorshifted\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def futureshifted(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'futureshifted\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def edhrec_rank(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'edhrec_rank\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def currency(self, mode):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'currency\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def related_uris(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'related_uris\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def purchase_uris(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'purchase_uris\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def life_modifier(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'life_modifier\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def hand_modifier(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'hand_modifier\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def color_indicator(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'color_indicator\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def all_parts(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'all_parts\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def card_faces(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'card_faces\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 14:19:38 +00:00
|
|
|
def watermark(self):
|
2018-10-22 15:05:11 +00:00
|
|
|
raise AttributeError('Autocomplete object has no attribute \'watermark\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 15:05:11 +00:00
|
|
|
def story_spotlight(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'story_spotlight\'')
|
2018-02-13 21:35:01 +00:00
|
|
|
|
2018-10-22 15:05:11 +00:00
|
|
|
def power(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'power\'')
|
|
|
|
|
|
|
|
def toughness(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'toughness\'')
|
|
|
|
|
|
|
|
def loyalty(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'loyalty\'')
|
|
|
|
|
|
|
|
def flavor_text(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'flavor_text\'')
|
|
|
|
|
|
|
|
def arena_id(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'arena_id\'')
|
|
|
|
|
|
|
|
def lang(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'lang\'')
|
|
|
|
|
|
|
|
def printed_name(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'printed_name\'')
|
|
|
|
|
|
|
|
def printed_type_line(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'printed_type_line\'')
|
|
|
|
|
|
|
|
def printed_text(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'printed_text\'')
|
|
|
|
|
|
|
|
def oracle_id(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'oracle_id\'')
|
|
|
|
|
|
|
|
def nonfoil(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'nonfoil\'')
|
|
|
|
|
|
|
|
def oversized(self):
|
|
|
|
raise AttributeError('Autocomplete object has no attribute \'oversized\'')
|