A library that provides a Python interface to Nightscout
Project description
Python Nightscout client
A simple python client for accessing data stored in Nightscout
Example Usage
To create an instance of the nightscout.Api class, with no authentication:
import nightscout
api = nightscout.Api('https://yournightscoutsite.herokuapp.com')
To use authentication, instantiate the nightscout.Api class with your api secret:
api = nightscout.Api('https://yournightscoutsite.herokuapp.com', api_secret='your api secret')
Glucose Values
To fetch recent sensor glucose values (SGVs):
entries = api.get_sgvs()
print([entry.sgv for entry in entries])
Specify time ranges:
api.get_sgvs({'count':0, 'find[dateString][$gte]': '2017-03-07T01:10:26.000Z'})
Treatments
To fetch recent treatments (boluses, temp basals):
treatments = api.get_treatments()
print([treatment.eventType for treatment in treatments])
Profiles
profile_definition_set = api.get_profiles()
profile_definition = profile_definition_set.get_profile_definition_active_at(datetime.now())
profile = profile_definition.get_default_profile()
print "Duration of insulin action = %d" % profile.dia
five_thirty_pm = datetime(2017, 3, 24, 17, 30)
five_thirty_pm = profile.timezone.localize(five_thirty_pm)
print "Scheduled basal rate at 5:30pm is = %f" % profile.basal.value_at_date(five_thirty_pm)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file python-nightscout-1.0.0.tar.gz
.
File metadata
- Download URL: python-nightscout-1.0.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7326cd1a57992597a1e64eaa210e67fc273f7b8097bbdf500ae7e830347ce824 |
|
MD5 | 584c3f3c313d6a38310e6b05dca7095e |
|
BLAKE2b-256 | 67c7d3e5e9479eb00f83ed452fb6bd8a7d609e549c1b2b2f462f821d8f5dacbd |
File details
Details for the file python_nightscout-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: python_nightscout-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 024dce2007e04d2e34fceab595b51ac0deff8a45cf838db0512095706610c18b |
|
MD5 | 66e1d4f7c787d9897550a519ca069c32 |
|
BLAKE2b-256 | 38d7abf4f6277f6e76f2b5acc42e99552d55edc19c1915df52252d0b4d4b727c |