From cf5d1f94f954e253699bdd9e2eaf2b9c130e3960 Mon Sep 17 00:00:00 2001 From: Nanda Scott Date: Wed, 13 Jun 2018 14:01:12 -0400 Subject: [PATCH] Added support for multilingual stuff. --- Changelog.md | 3 +++ scrython/cards/cards_object.py | 17 ++++++++++++++++- scrython/cards/collector.py | 8 +++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 54e06a3..4635445 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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 diff --git a/scrython/cards/cards_object.py b/scrython/cards/cards_object.py index ed89905..0e90707 100644 --- a/scrython/cards/cards_object.py +++ b/scrython/cards/cards_object.py @@ -392,4 +392,19 @@ class CardsObject(object): def lang(self): self._checkForKey('lang') - return self.scryfallJson['lang'] \ No newline at end of file + 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'] \ No newline at end of file diff --git a/scrython/cards/collector.py b/scrython/cards/collector.py index 0b02915..0acaa66 100644 --- a/scrython/cards/collector.py +++ b/scrython/cards/collector.py @@ -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)