Scrython/scrython/cards/collector.py

34 lines
1.0 KiB
Python
Raw Normal View History

from .cards_object import CardsObject
class Collector(CardsObject):
2018-10-22 14:19:38 +00:00
"""
cards/collector
Get a card by collector number.
2018-02-21 19:42:58 +00:00
2018-10-22 14:19:38 +00:00
Positional arguments:
code : str ....................... This is the 3 letter code for the set
collector_number : str ........ This is the collector number of the card
2018-02-21 19:42:58 +00:00
2018-10-22 14:19:38 +00:00
Optional arguments:
Inherits all arguments from CardsObject
2018-02-21 19:42:58 +00:00
2018-10-22 14:19:38 +00:00
lang : str ............................... A 2-3 character language code
2018-06-13 18:01:12 +00:00
2018-10-22 14:19:38 +00:00
Attributes:
Inherits all attributes from CardsObject
2018-02-21 19:42:58 +00:00
2018-10-22 14:19:38 +00:00
Example usage:
>>> card = scrython.cards.Collector(code='exo', collector_number='96')
>>> card.id()
"""
def __init__(self, **kwargs):
if kwargs.get('code') is None:
raise TypeError('No code provided to search by')
2018-02-13 21:51:03 +00:00
2018-10-22 14:19:38 +00:00
self.url = 'cards/{}/{}/{}?'.format(
kwargs.get('code'),
str(kwargs.get('collector_number')),
kwargs.get('lang', 'en')
)
super(Collector, self).__init__(self.url)