The get_current_glucose_reading() method retrieves the most recent glucose data from the Dexcom Share service. It returns a glucose reading object containing several attributes.
Available Attributes on the reading object:
value: The glucose reading in mg/dL.mmol_l: The glucose reading in mmol/L.trend: An integer representing the trend.trend_direction: A string describing the direction (e.g., 'Flat').trend_description: A string describing the trend (e.g., 'steady').trend_arrow: A visual representation of the trend (e.g., '→').datetime: The timestamp of the reading.json: A dictionary representation of the reading data.
Note: This package is designed for real-time data. The official Dexcom Developer API is retrospective and not suitable for real-time fetching.
from pydexcom import Dexcom
dexcom = Dexcom(username="username", password="password")
glucose_reading = dexcom.get_current_glucose_reading()
print(glucose_reading.value) # e.g., 85
print(glucose_reading.mmol_l) # e.g., 4.7
print(glucose_reading.trend_direction) # e.g., 'Flat'
print(glucose_reading.trend_arrow) # e.g., '→'
print(glucose_reading.datetime) # e.g., 2023-08-07 20:40:58
print(glucose_reading.json) # Returns a dict of the reading