Scrython/scrython/cards/named.py

39 lines
1001 B
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-02-21 19:42:58 +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):
2018-02-13 21:51:03 +00:00
self.dict = {
2018-02-14 02:02:48 +00:00
'set':kwargs.get('set', '')
2018-02-13 21:51:03 +00:00
}
2018-01-10 01:59:55 +00:00
2018-02-14 02:02:48 +00:00
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)