From f4d042f886c36f5b7a3748ceb6971763f471c629 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Wed, 7 Oct 2015 18:40:13 +0100 Subject: [PATCH] Fixed JSON being stored with single rather than double quotes. --- wanikaniburned.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wanikaniburned.py b/wanikaniburned.py index 3b24937..efea733 100644 --- a/wanikaniburned.py +++ b/wanikaniburned.py @@ -59,7 +59,7 @@ class User(db.Model): self.username = data['user_information']['username'] self.gravatar = data['user_information']['gravatar'] if data.get('requested_information'): - self.radicals = str(data['requested_information']) + self.radicals = json.dumps(data['requested_information']) def parse_kanji(self): response = requests.get("https://www.wanikani.com/api/user/" + self.api_key + "/kanji/") @@ -68,7 +68,7 @@ class User(db.Model): if data.get('error'): raise ValueError(data['error']['message']) if data.get('requested_information'): - self.kanji = str(data['requested_information']) + self.kanji = json.dumps(data['requested_information']) def parse_vocabulary(self): response = requests.get("https://www.wanikani.com/api/user/" + self.api_key + "/vocabulary/") @@ -77,7 +77,7 @@ class User(db.Model): if data.get('error'): raise ValueError(data['error']['message']) if data.get('requested_information'): - self.vocabulary = str(data['requested_information']['general']) + self.vocabulary = json.dumps(data['requested_information']['general']) def update_all(self): if (datetime.utcnow() - self.last_updated) > timedelta(hours=1):