A library that provides a Python interface to Nightscout
Project description
# Python Nightscout client
[![Build Status](https://travis-ci.org/marciogranzotto/py-nightscout.svg?branch=master)](https://travis-ci.org/marciogranzotto/py-nightscout)
A simple python client for accessing data stored in [Nightscout](https://github.com/nightscout/cgm-remote-monitor) Based on [ps2/python-nightscout](https://github.com/ps2/python-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)
### Server Status
server_status = api.get_status()
print(server_status.status)
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
Hashes for py_nightscout-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a21525cc1d53632ba2eca7a4336edf6239541d5f67dad6e4e83775c2f30760a2 |
|
MD5 | a032142aaa2227efcce8a4677bae6e70 |
|
BLAKE2b-256 | 326db9e08db6cee3528302fe316e4539665b6c19479131124e676e92507baed8 |