This Client communicate with the non-publicly Freeletics API.
This Client is still in progress. Help is welcome!
Working on data models for API response and ETag/If-None-Match header to reduce traffic.
freeletics needs at least Python 3.8.
It depends on the following packages:
This package is not on PyPi at this moment. To install freeletics you have to clone it from this repo.
git clone https://github.com/mkb79/freeletics-python.git
cd freeletics-python
pip install .
from freeletics import FreeleticsClient
with FreeleticsClient() as client:
client.login(USERNAME, PASSWORD)
payment = client.get_payment_claims()
profile = client.get_user_profile()
client.logout()
Do not forget to log out. Otherwise, the refresh token will not be deleted on the server. I do not know what will happen, if you have multiple unused refresh tokens.
If you do not want to log in everytime, you can reuse the session this way:
from freeletics import Credentials, FreeleticsClient
with FreeleticsClient() as client:
client.login(USERNAME, PASSWORD)
cred = client.get_credentials()
cred.to_file(FILENAME)
cred = Credentials.from_file(FILENAME).as_dict()
with FreeleticsClient.from_credentials(**cred) as client:
...
Important note:
Please be careful when the client refresh the id_token
. Do not use the old id_token
again. Otherwise, the Freeletics API server will quit this with an HTTP Error 404 (when the old id_token
is expired) and your refresh_token
will be invalid.
@Freeletics engineers: It would be very helpful if you open your API. My goal is only to get my personal training stats from the API. If there is a way please contact me.