diff --git a/docs/Glucosemeter Project Logboek.docx b/docs/Glucosemeter Project Logboek.docx index a7c8455..dcb12fd 100644 Binary files a/docs/Glucosemeter Project Logboek.docx and b/docs/Glucosemeter Project Logboek.docx differ diff --git a/src/GlucoseCheck.py b/src/GlucoseCheck.py index e158047..03d845a 100644 --- a/src/GlucoseCheck.py +++ b/src/GlucoseCheck.py @@ -12,14 +12,9 @@ send_topic = "telegrambot/out/gj" brokercreds = ["hass","Bruk#5"] ##### Variables ##### -# Login credentials -payload = { - "email": "gjkoolen@gmail.com", - "password": "VropZup#3x" -} # API JWT token, Account-Id and Patient_Id -jwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM1ZGVhZGZiLTNlZDYtMTFlYS1hZjZmLTAyNDJhYzExMDAwYSIsImZpcnN0TmFtZSI6IkdlcnRqYW4iLCJsYXN0TmFtZSI6Iktvb2xlbiIsImNvdW50cnkiOiJOTCIsInJlZ2lvbiI6ImV1Iiwicm9sZSI6InBhdGllbnQiLCJlbWFpbCI6Imdqa29vbGVuQGdtYWlsLmNvbSIsInMiOiJsbHUuYW5kcm9pZCIsInNpZCI6IjM1YTBhMTcxLTk1Y2QtNDg3ZC1iZmQxLTE3NGY1MTMwZjdlZSIsInRhc2tUeXBlIjoicHAiLCJleHAiOjE3NTM5NjE2MTYsImlhdCI6MTc1Mzk1ODAxNiwianRpIjoiYTIwMzZiOTMtYjM5Yi00OWM2LThiODctMDk2NTYxMGMzODMyIn0.sxoCs9gDr9DfbMnoz4yZCilMiJ-RlN_Uwb1IHDTRfg0" +jwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM1ZGVhZGZiLTNlZDYtMTFlYS1hZjZmLTAyNDJhYzExMDAwYSIsImZpcnN0TmFtZSI6IkdlcnRqYW4iLCJsYXN0TmFtZSI6Iktvb2xlbiIsImNvdW50cnkiOiJOTCIsInJlZ2lvbiI6ImV1Iiwicm9sZSI6InBhdGllbnQiLCJzIjoibGx1LmFuZHJvaWQiLCJzaWQiOiIxNjE5NmZkMy1mMmEzLTQ0MWMtOGEwZi03Y2Y2YjAyODQwZjYiLCJleHAiOjE3Njk1ODY1NjgsImlhdCI6MTc1NDAzNDU2OCwianRpIjoiNWQwZjI4NTctZmI2My00ZDlhLWE4MDAtZjVhNWNhMjg4MzZiIn0.4GupiVfdhIlavbMTTNQcy8UMeAvwnsSzdmfvQMVcoV8" Account_ID = "dad20d62aeef891d94bda411af269900180cb7b84a0ce51d60b52463339935b1" Patient_ID = "c5deadfb-3ed6-11ea-af6f-0242ac11000a" # API endpoint for login @@ -80,7 +75,7 @@ def main(url_main, headers_main): while True: try: # Send the Get request - response = requests.get(url_main, json=payload, headers=headers_main) # json=payload + response = requests.get(url_main, headers=headers_main) # json=payload if response.status_code == 200: # If request has succeeded data = response.json() diff --git a/src/Glucose_http_jwt.py b/src/Glucose_http_jwt.py new file mode 100644 index 0000000..4db1bca --- /dev/null +++ b/src/Glucose_http_jwt.py @@ -0,0 +1,36 @@ +import requests + +# API endpoint for login +url = "https://api-eu.libreview.io/llu/auth/login" # Replace with the actual API URL + +# Login credentials +payload = { + "email": "gjkoolen@gmail.com", + "password": "VropZup#3x" +} + +# Headers +headers = { + 'accept-encoding': 'gzip', + 'cache-control': 'no-cache', + 'connection': 'Keep-Alive', + 'content-type': 'application/json', + 'product': 'llu.android', + 'version': '4.7' + } + +# 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) + else: + print("Status = ", data.get("status")) + print("Login failed: Unexpected response format") +else: + print("Login failed:", response.status_code, response.text) \ No newline at end of file