From fb2923b168e1e72082bca4e055de826702ea5471 Mon Sep 17 00:00:00 2001 From: EllieJaybee Date: Sun, 8 Jan 2023 03:12:05 +0800 Subject: [PATCH] Fix def being unusable because python moment --- README.rst | 2 +- yugioh/__init__.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index fc14891..4027a6f 100644 --- a/README.rst +++ b/README.rst @@ -40,7 +40,7 @@ Monster Attributes +--------------------+---------------------------------+ | attribute | The card's attribute | +--------------------+---------------------------------+ -| def | The card's defense points | +| def_ | The card's defense points | +--------------------+---------------------------------+ | desc | The card's description | +--------------------+---------------------------------+ diff --git a/yugioh/__init__.py b/yugioh/__init__.py index 95a2848..bec8bc4 100644 --- a/yugioh/__init__.py +++ b/yugioh/__init__.py @@ -4,7 +4,10 @@ class Card: def __init__(self, q): for key, value in q.items(): if key not in ("card_sets", "card_images", "card_prices"): - setattr(self, key, value) + if key == "def": + setattr(self, "def_", value) + else: + setattr(self, key, value) def __get(parameters): return requests.get('https://db.ygoprodeck.com/api/v7/cardinfo.php',