Scrython/scrython/cards/cardid.py

43 lines
1.4 KiB
Python
Raw Normal View History

from .cards_object import CardsObject
class Id(CardsObject):
2018-10-22 14:19:38 +00:00
"""
cards/id
Get a card by the Scryfall id.
2018-02-21 19:42:58 +00:00
Args:
id (string):
The Scryfall Id of the card.
format (string, optional):
Defaults to 'json'.
Returns data in the specified method.
face (string, optional):
Defaults to empty string.
If you're using the `image` format, this will specify if you want the front or back face.
version (string, optional):
Defaults to empty string.
If you're using the `image` format, this will specify if you want the small, normal,
large, etc version of the image.
pretty (string, optional):
Defaults to empty string.
Returns a prettier version of the json object.
Note that this may break functionality with Scrython.
2018-02-21 19:42:58 +00:00
Returns:
N/A
Raises:
Exception: If the 'id' parameter is not provided.
Exception: If the object returned is an error.
2018-02-21 19:42:58 +00:00
2018-10-28 05:09:09 +00:00
Examples:
2018-10-22 14:19:38 +00:00
>>> card = scrython.cards.Id(id="5386a61c-4928-4bd1-babe-5b089ab8b2d9")
>>> card.name()
"""
def __init__(self, **kwargs):
if kwargs.get('id') is None:
raise Exception('No id provided to search by')
2018-02-13 21:51:03 +00:00
2018-10-22 14:19:38 +00:00
self.url = 'cards/{}?'.format(str(kwargs.get('id')))
super(Id, self).__init__(self.url)