lauslim12 / japanese-duolingo-visualizer

独学で日本語を勉強しています。これはDuolingo統計の進歩。Developed with Python, Poetry, GitHub Actions/Pages.

Home Page:https://lauslim12.github.io/japanese-duolingo-visualizer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BreakingAPIChange

GiveMeFox opened this issue · comments

os: 6.4.12-arch1-1
command: poetry run python3 main.py

[JDV] Japanese Duolingo Visualizer script has successfully logged in to your account.
[JDV] Japanese Duolingo Visualizer script logged in to your account with JWT method.
[JDV] BreakingAPIChange: API response does not conform to the schema. Perhaps the response from the server may have been changed.
[JDV] Japanese Duolingo Visualizer script has finished running.

image

Hi there! Thank you for submitting an issue in this project!

This is actually quite strange to me because I've never seen this problem before, at least for my use-case, the automation is always successful everyday (unless when the Duolingo API is down or any other unexpected occurrences) 🤔

From my understanding, BreakingAPIChange means that the response from the server, either in get_user_data() or in get_summaries() method call fails the Pydantic validation. As a first step to solve this, could you try to manually access these URLs in your browser (you have to be logged in to Duolingo website):

  • https://www.duolingo.com/users/{username}
  • https://www.duolingo.com/2017-06-30/users/{user_id_from_the_above_endpoint}/xp_summaries?startDate=1970-01-01

And then, let me know whether the JSON schema there is the same as the schema that I have written in the codebase?

Thank you!

Same issue, seems like it comes from get_summaries. Have checked both the shema and the urls, they're the same (just not same order but we don't care)

Here's a screenshot of validation error :
image

Hello @Asusho!

Sorry for the late response. I'm not sure what you mean by "the same order". In your screenshot, it shows that pydantic is having problems parsing the data which comes from get_summaries, which somehow returns None in summaries[0]. If that is the case, then maybe you haven't had any Duolingo progression so far?

In #14, I improved the whole program and tried to make the visualizer much more accurate in terms of algorithm, data structure, and typing. Could you try to do what you were trying to do again with the latest version? If the same error still persists, then I think I have to take a look at the response from the Duolingo's API to make sure that everything is correct according to the pydantic schema.

Thank you!