KartikTalwar / Duolingo

Unofficial Duolingo API Written in Python
MIT License
822 stars 129 forks source link

Feature request - get Lingots amount #95

Closed TiloGit closed 4 years ago

TiloGit commented 4 years ago

hi, is there an URL/API to report the amount of Lingots I have?

igorskh commented 4 years ago

Hi,

With the latest version you can use get_data_by_user_id method like this:

import duolingo

lingo = duolingo.Duolingo('<username>', '<password>')
user_data_resp = lingo.get_data_by_user_id(['lingots'])
print(user_data_resp)
print(user_data_resp['lingots'])

It should show something like this:

{'lingots': 11014}
11014

This method calls this URL: /2017-06-30/users/?fields=lingots

You can also check most of available for get_data_by_user_id method fields here: https://duolingo-api.roundeasy.vercel.app/#operation/getUser

They can be easily passed in a list to the method like this:

user_data_resp = lingo.get_data_by_user_id(['lingots', 'totalXp'])
TiloGit commented 4 years ago

super danke.