Skip to main content

Python API to interact with Dexcom Share API

Project description

PyPI Python versions Pre-commit Tests Docs

A simple Python API to interact with Dexcom Share service. Used to get real-time Dexcom CGM sensor data.

Quick-start

  1. Download the Dexcom G7 / G6 / G5 / G4 mobile app and enable the Share service.

The Dexcom Share service requires setup of at least one follower to enable the share service, but pydexcom will use your credentials, not the follower's

[! CAUTION] With the release of the Dexcom G7, users are now able to authenticate with a mobile phone or email address. pydexcom currently does not support this, only legacy username-based authentication.

While this is being resolved, please authenticate using your account ID. You can find your account ID by logging in to uam1.dexcom.com for US users or uam2.dexcom.com for users outside of the US. After logging in, note the UUID in the URL -- this is your account ID.

  1. Install the pydexcom package.

pip3 install pydexcom

  1. Profit.
>>> from pydexcom import Dexcom
>>> dexcom = Dexcom(account_id="account_id", password="password") # `ous=True` if outside of US
>>> dexcom = Dexcom(username="username", password="password") # legacy username accounts only
>>> glucose_reading = dexcom.get_current_glucose_reading()
>>> print(glucose_reading)
85

>>> glucose_reading.value
85

>>> glucose_reading.mmol_l
4.7

>>> glucose_reading.trend
4

>>> glucose_reading.trend_direction
'Flat'

>>> glucose_reading.trend_description
'steady'

>>> glucose_reading.trend_arrow
'→'

>>> print(bg.datetime)
2023-08-07 20:40:58

>>> glucose_reading.json
{'WT': 'Date(1691455258000)', 'ST': 'Date(1691455258000)', 'DT': 'Date(1691455258000-0400)', 'Value': 85, 'Trend': 'Flat'}

Documentation

https://gagebenne.github.io/pydexcom/pydexcom.html

Frequently Asked Questions

Why is my password not working?

The Dexcom Share API understandably reports limited information during account validation. If anything is incorrect, the API simply reports back invalid password ( pydexcom.errors.AccountErrorEnum ). However, there could be many reasons you are getting this error:

  1. Use the correct Dexcom Share API instance.

If you are located outside of the United States, be sure to set ous=True when initializing Dexcom .

  1. Use your Dexcom Share credentials, not the follower's credentials.

Use the same credentials used to login to the Dexcom mobile application publishing the glucose readings.

  1. Ensure you have at least one follower on Dexcom Share.

The Dexcom Share service requires setup of at least one follower to enable the service, as does this package.

  1. Check whether your account credentials involve usernames or emails.

There are two account types the Dexcom Share API uses: legacy username-based accounts, and newer email-based accounts. Be sure to use the correct authentication method.

  1. Use alpha-numeric passwords.

Some individuals have had problems with connecting when their Dexcom Share passwords are entirely numeric. If you have connection issues, try changing your password to something with a mix of numbers and letters.

  1. Report it!

The Dexcom Share API sometimes changes. If you believe there is an issue with pydexcom , feel free to create an issue if one has not been created yet already.

Why not use the official Dexcom Developer API?

The official Dexcom API is a great tool to view trends, statistics, and day-by-day data, but is not suitable for real time fetching of glucose readings as it is a retrospective API.

How can I let you know of suggestions or issues?

By all means submit a pull request if you have a feature you would like to see in the next release. Alternatively, you may create an issue if you have a suggestion or bug you'd like to report.

Where is this package being used?

Primarily this package is used in the Home Assistant Dexcom integration, but it's fantastic to see community projects involving pydexcom :

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydexcom-0.4.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

pydexcom-0.4.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file pydexcom-0.4.0.tar.gz.

File metadata

  • Download URL: pydexcom-0.4.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pydexcom-0.4.0.tar.gz
Algorithm Hash digest
SHA256 22141686a0bb0451be8567efb6bee5ff952a62ef4261aa9bdc6ce455589245b9
MD5 66f9ac1c92258b08d677582eb541aa77
BLAKE2b-256 96094cd5b48f8ae8b30f3fc6af6806d160d559d51c2b9006ea2f3ed9e5d8ed2e

See more details on using hashes here.

File details

Details for the file pydexcom-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pydexcom-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pydexcom-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ec5037d5f978efcbf7a7a0d53b6db92bc6fc5b2f00bd0536f076e233693e583
MD5 b662d12e77aa72fff604a1da921fa9ec
BLAKE2b-256 48a8db23b279ae7c8eb3b12b46dbc2a099fe2c4354e13e71cebe548d7be40876

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page