Updated JWT token
And added Documentation over how to get new JWT token.
This commit is contained in:
parent
0ab321cea0
commit
b3c92b4bae
3 changed files with 38 additions and 7 deletions
Binary file not shown.
|
|
@ -12,14 +12,9 @@ send_topic = "telegrambot/out/gj"
|
||||||
brokercreds = ["hass","Bruk#5"]
|
brokercreds = ["hass","Bruk#5"]
|
||||||
|
|
||||||
##### Variables #####
|
##### Variables #####
|
||||||
# Login credentials
|
|
||||||
payload = {
|
|
||||||
"email": "gjkoolen@gmail.com",
|
|
||||||
"password": "VropZup#3x"
|
|
||||||
}
|
|
||||||
|
|
||||||
# API JWT token, Account-Id and Patient_Id
|
# API JWT token, Account-Id and Patient_Id
|
||||||
jwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM1ZGVhZGZiLTNlZDYtMTFlYS1hZjZmLTAyNDJhYzExMDAwYSIsImZpcnN0TmFtZSI6IkdlcnRqYW4iLCJsYXN0TmFtZSI6Iktvb2xlbiIsImNvdW50cnkiOiJOTCIsInJlZ2lvbiI6ImV1Iiwicm9sZSI6InBhdGllbnQiLCJlbWFpbCI6Imdqa29vbGVuQGdtYWlsLmNvbSIsInMiOiJsbHUuYW5kcm9pZCIsInNpZCI6IjM1YTBhMTcxLTk1Y2QtNDg3ZC1iZmQxLTE3NGY1MTMwZjdlZSIsInRhc2tUeXBlIjoicHAiLCJleHAiOjE3NTM5NjE2MTYsImlhdCI6MTc1Mzk1ODAxNiwianRpIjoiYTIwMzZiOTMtYjM5Yi00OWM2LThiODctMDk2NTYxMGMzODMyIn0.sxoCs9gDr9DfbMnoz4yZCilMiJ-RlN_Uwb1IHDTRfg0"
|
jwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM1ZGVhZGZiLTNlZDYtMTFlYS1hZjZmLTAyNDJhYzExMDAwYSIsImZpcnN0TmFtZSI6IkdlcnRqYW4iLCJsYXN0TmFtZSI6Iktvb2xlbiIsImNvdW50cnkiOiJOTCIsInJlZ2lvbiI6ImV1Iiwicm9sZSI6InBhdGllbnQiLCJzIjoibGx1LmFuZHJvaWQiLCJzaWQiOiIxNjE5NmZkMy1mMmEzLTQ0MWMtOGEwZi03Y2Y2YjAyODQwZjYiLCJleHAiOjE3Njk1ODY1NjgsImlhdCI6MTc1NDAzNDU2OCwianRpIjoiNWQwZjI4NTctZmI2My00ZDlhLWE4MDAtZjVhNWNhMjg4MzZiIn0.4GupiVfdhIlavbMTTNQcy8UMeAvwnsSzdmfvQMVcoV8"
|
||||||
Account_ID = "dad20d62aeef891d94bda411af269900180cb7b84a0ce51d60b52463339935b1"
|
Account_ID = "dad20d62aeef891d94bda411af269900180cb7b84a0ce51d60b52463339935b1"
|
||||||
Patient_ID = "c5deadfb-3ed6-11ea-af6f-0242ac11000a"
|
Patient_ID = "c5deadfb-3ed6-11ea-af6f-0242ac11000a"
|
||||||
# API endpoint for login
|
# API endpoint for login
|
||||||
|
|
@ -80,7 +75,7 @@ def main(url_main, headers_main):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
# Send the Get request
|
# 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
|
if response.status_code == 200: # If request has succeeded
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
|
|
|
||||||
36
src/Glucose_http_jwt.py
Normal file
36
src/Glucose_http_jwt.py
Normal file
|
|
@ -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)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue