Scrython/scrython/cards/named.py

30 lines
759 B
Python
Raw Normal View History

from .scryfall_object import ScryfallObject
import urllib.parse
2018-01-10 01:59:55 +00:00
class Named(ScryfallObject):
"""
2018-01-11 01:02:33 +00:00
Parameters:
exact: str The exact card name to search for, case insenstive.
fuzzy: str A fuzzy card name to search for.
set: str A set code to limit the search to one set.
2018-01-10 01:59:55 +00:00
"""
def __init__(self, **kwargs):
self.exact = kwargs.get('exact')
self.fuzzy = kwargs.get('fuzzy')
self.set = kwargs.get('set')
self.dict = {}
2018-01-10 01:59:55 +00:00
if self.exact is not None:
self.dict['exact'] = self.exact
2018-01-10 01:59:55 +00:00
if self.fuzzy is not None:
self.dict['fuzzy'] = self.fuzzy
2018-01-10 01:59:55 +00:00
if self.set is not None:
self.dict['set'] = self.set
2018-01-10 01:59:55 +00:00
self.args = urllib.parse.urlencode(self.dict)
self.url = 'cards/named?' + self.args
super(Named, self).__init__(self.url)