Fixed JSON being stored with single rather than double quotes.

This commit is contained in:
neviyn 2015-10-07 18:40:13 +01:00
parent 451083cf0b
commit f4d042f886

View File

@ -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):