KartikTalwar / Duolingo

Unofficial Duolingo API Written in Python
MIT License
825 stars 128 forks source link

buy_streak_freeze() is no longer working: error 403 is returned #63

Closed andreasscherbaum closed 4 years ago

andreasscherbaum commented 5 years ago

I'm using the buy_streak_freeze() function in a script, and recently it started hitting an error. Enabling debugging brings up the following:

DEBUG: https://www.duolingo.com:443 "POST /2017-06-30/users/<id>/purchase-store-item HTTP/1.1" 403 396

Was the API changed again?

TiloGit commented 5 years ago

same with buy rupee_wager Trace with Browser F12 tools if that helped: URL: https://www.duolingo.com/2017-06-30/users/1_____8/shop-items

Post

{
    "itemName": "rupee_wager",
    "learningLanguage": "es"
}

Response

{
    "purchaseId": "341eb_removed__08",
    "purchaseDate": 1566936956,
    "purchasePrice": 5,
    "id": "rupee_wager",
    "itemName": "rupee_wager",
    "wagerDay": 0,
    "subscriptionInfo": null
}
andreasscherbaum commented 5 years ago

Looks like they changed the shop URL and the variable name.

Submitted #65 to solve that problem.

Appreciate it if someone else can test that with another shop item, which is not a streak.

andreasscherbaum commented 5 years ago

My script is working again:

INFO: bought streak extension for: ****
INFO: Streak extended today: False
INFO: Streak days: ****
TiloGit commented 5 years ago

worked for me to Buy Double or nothing aka rupee_wager

START RequestId: ac980b59-aaaa-bbbb-cccc-ac86c4b41847 Version: $LATEST
TestTiloHere
environment variable: MyDuoName
loaded one: MyDuoName
Trying to check get_languages for MyDuoName
MyDuoName get_languages for ['Spanish']
Trying to check get_streak_info for MyDuoName
MyDuoNameget_streak_info for {'daily_goal': 50, 'site_streak': 1277, 'streak_extended_today': True}
Trying to Buy Streak Freeze for MyDuoName
MyDuoName streak freeze for False
Trying to Buy Double or nothing for MyDuoName
Bought Double or nothing for MyDuoName
END RequestId: ac980b59-aaaa-bbbb-cccc-ac86c4b41847
REPORT RequestId: ac980b59-aaaa-bbbb-cccc-ac86c4b41847  Duration: 5165.99 ms    Billed Duration: 5200 ms    Memory Size: 128 MB Max Memory Used: 68 MB  Init Duration: 117.30 ms