Glucose-Checker/src/Glucose_http_jwt.py
gjkoolen b5fde01c63 Now works with new protocol
And the docs are now in Nextcloud
2025-10-20 16:28:54 +02:00

37 lines
1,000 B
Python

import requests
# API endpoint for login
url = "https://api-eu.libreview.io/llu/auth/login"
# Login credentials
payload = {
"email": "gjkoolen@gmail.com",
"password": "VropZup#3x"
}
# Headers
headers = {
'accept-encoding': 'gzip',
'cache-control': 'no-cache',
'connection': 'Keep-Alive',
'Accept': 'application/json',
'product': 'llu.android',
'version': '4.16'
}
# Send the POST request
response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200:
data = response.json()
# Ensure the response contains the expected structure
if data.get("status") == 0 and "authTicket" in data.get("data", {}):
jwt_token = data["data"]["authTicket"]["token"]
print("Login successful! JWT Token:", jwt_token)
print(data);
else:
print("Status = ", data.get("status"))
print("Login failed: Unexpected response format")
else:
print("Login failed:", response.status_code, response.text)