pylibrelinkup
is a Python client for the LibreLinkUp API, which allows you to interact with the LibreLinkUp service to retrieve glucose data and other related information. This project is a Python implementation inspired by the libre-link-up-api-client project.
To install pylibrelinkup
, you can use pip
:
pip install pylibrelinkup
First, you need to import the necessary modules, initialize the client, and authenticate with your LibreLinkUp credentials:
from pylibrelinkup import PyLibreLinkUp
client = PyLibreLinkUp(email='your_username', password='your_password')
client.authenticate()
You can fetch the list of patients using the get_patients
method:
patient_list = client.get_patients()
print(patient_list)
Retrieve patient data using the read
method:
patient = patient_list[0]
patient_data = client.read(patient_identifier=patient.patient_id)
The read
method accepts a patient_identifier
parameter in the form of a UUID
, str
, or Patient
object.
Get the latest glucose data:
latest_glucose = patient_data.current
print(latest_glucose)
Get the historical glucose data:
historical_glucose = patient_data.history
print(historical_glucose)
full example:
from pylibrelinkup import PyLibreLinkUp
client = PyLibreLinkUp(email='your_username', password='your_password')
client.authenticate()
patient_list = client.get_patients()
print(patient_list)
patient = patient_list[0]
patient_data = client.read(patient_identifier=patient.patient_id)
print(f"Current glucose: {patient_data.current}")
print(f"Historical glucose: {patient_data.history}")