Scrython/scrython/cards/named.py

39 lines
1.1 KiB
Python
Raw Normal View History

from .cards_object import CardsObject
import urllib.parse
2018-01-10 01:59:55 +00:00
class Named(CardsObject):
2018-10-22 14:19:38 +00:00
"""
cards/named
Gets a card by the name.
Positional arguments:
fuzzy : str ................ Uses the fuzzy parameter for the card name.
or
exact : str ................ Uses the exact parameter for the card name.
Optional arguments:
set : str . Returns the set of the card if specified. Requires the 3 letter set code.
All arguments are inherited from CardsObject
Attributes:
All attributes are inherited from CardsObject
Example usage:
>>> card = scrython.cards.Named(exact="Black Lotus")
>>> card.colors()
"""
def __init__(self, **kwargs):
self.dict = {
'set':kwargs.get('set', '')
}
if kwargs.get('exact') is not None:
self.dict['exact'] = kwargs.get('exact')
if kwargs.get('fuzzy') is not None:
self.dict['fuzzy'] = kwargs.get('fuzzy')
self.args = urllib.parse.urlencode(self.dict)
self.url = 'cards/named?' + self.args
super(Named, self).__init__(self.url)