Closed jonoruss closed 9 years ago
I've commited a new change to the api that allows you to login. It should resolve the language_progress issue
Thanks!
On Sun, May 10, 2015 at 8:44 PM Kartik Talwar notifications@github.com wrote:
Closed #9 https://github.com/KartikTalwar/Duolingo/issues/9.
— Reply to this email directly or view it on GitHub https://github.com/KartikTalwar/Duolingo/issues/9#event-301307819.
I've been toying around with this, and I noticed that if I did the following:
It would produce the following:
C:\Workspaces\python sandbox>python duo.py {'streak': 49, 'language_string': u'Portuguese', 'level_progress': 717, 'level_percent': 65, 'language': u'pt', 'points_rank': 3, 'level_points': 1100, 'next_level': 14, 'points': 5617, 'num_skills_learned': 40, 'level_left': 383} Traceback (most recent call last): File "duo.py", line 46, in
print lingo.get_language_progress('de');
File "C:\Python27\lib\site-packages\duolingoinit.py", line 111, in get_language_progress
return self._make_dict(fields, self.user_data.language_data[lang])
KeyError: 'de'
Apparently, this "get_language_progress" only gets the progress if we're logged into that language. Once I log into german, it no longer gets portuguese. It's evidently trying to parse the language JSON returned when we load the page, but that only returns one language at a time.
Since this function only gets the current language anyway, why should this take in a language as an input? Instead of this:
Why not this:
I've tested that, and I think it works pretty well. Alternatively, is there a way to get multiple languages' data at once?