Added support for multilingual stuff.

This commit is contained in:
Nanda Scott 2018-06-13 14:01:12 -04:00
parent b9ca5393c6
commit cf5d1f94f9
3 changed files with 26 additions and 2 deletions

View File

@ -6,6 +6,9 @@ New stuff
- Arena IDs are now accessible from all `cards` objects with `arena_id()`.
- The `lang` attribute is now accessible from all `cards` objects with `lang()`
- `printed_name()`, `printed_type_line()`, `printed_text()` have been added to all `card`
objects.
- `lang` optional argument has now been added to `Collector()` object. Defaults to `en`
Changes

View File

@ -393,3 +393,18 @@ class CardsObject(object):
self._checkForKey('lang')
return self.scryfallJson['lang']
def printed_name(self):
self._checkForKey('printed_name')
return self.scryfallJson['printed_name']
def printed_type_line(self):
self._checkForKey('printed_type_line')
return self.scryfallJson['printed_type_line']
def printed_text(self):
self._checkForKey('printed_text')
return self.scryfallJson['printed_text']

View File

@ -12,6 +12,8 @@ class Collector(CardsObject):
Optional arguments:
Inherits all arguments from CardsObject
lang : str ............................... A 2-3 character language code
Attributes:
Inherits all attributes from CardsObject
@ -23,5 +25,9 @@ class Collector(CardsObject):
if kwargs.get('code') is None:
raise TypeError('No code provided to search by')
self.url = 'cards/{}/{}?'.format(kwargs.get('code'), str(kwargs.get('collector_number')))
self.url = 'cards/{}/{}/{}?'.format(
kwargs.get('code'),
str(kwargs.get('collector_number')),
kwargs.get('lang', 'en')
)
super(Collector, self).__init__(self.url)