# Python Nightscout client
[![Build Status](https://travis-ci.org/ps2/python-nightscout.svg?branch=master)](https://travis-ci.org/ps2/python-nightscout)
A simple python client for accessing data stored in [Nightscout](https://github.com/nightscout/cgm-remote-monitor)
## 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)
Raw data
{
"_id": null,
"home_page": "https://github.com/ps2/python-nightscout",
"name": "python-nightscout",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "nightscout api client development",
"author": "Pete Schwamb",
"author_email": "pete@schwamb.net",
"download_url": "https://files.pythonhosted.org/packages/67/c7/d3e5e9479eb00f83ed452fb6bd8a7d609e549c1b2b2f462f821d8f5dacbd/python-nightscout-1.0.0.tar.gz",
"platform": null,
"description": "# Python Nightscout client\n\n[![Build Status](https://travis-ci.org/ps2/python-nightscout.svg?branch=master)](https://travis-ci.org/ps2/python-nightscout)\n\nA simple python client for accessing data stored in [Nightscout](https://github.com/nightscout/cgm-remote-monitor)\n\n## Example Usage\n\nTo create an instance of the nightscout.Api class, with no authentication:\n\n\timport nightscout\n api = nightscout.Api('https://yournightscoutsite.herokuapp.com')\n\nTo use authentication, instantiate the nightscout.Api class with your\n api secret:\n\n\tapi = nightscout.Api('https://yournightscoutsite.herokuapp.com', api_secret='your api secret')\n\n### Glucose Values\nTo fetch recent sensor glucose values (SGVs):\n\n\tentries = api.get_sgvs()\n\tprint([entry.sgv for entry in entries])\n\nSpecify time ranges:\n\n\tapi.get_sgvs({'count':0, 'find[dateString][$gte]': '2017-03-07T01:10:26.000Z'})\n\n### Treatments\nTo fetch recent treatments (boluses, temp basals):\n\n\ttreatments = api.get_treatments()\n\tprint([treatment.eventType for treatment in treatments])\n\n### Profiles\n\n\tprofile_definition_set = api.get_profiles()\n\n\tprofile_definition = profile_definition_set.get_profile_definition_active_at(datetime.now())\n\n\tprofile = profile_definition.get_default_profile()\n\n\tprint \"Duration of insulin action = %d\" % profile.dia\n\n\tfive_thirty_pm = datetime(2017, 3, 24, 17, 30)\n\tfive_thirty_pm = profile.timezone.localize(five_thirty_pm)\n\tprint \"Scheduled basal rate at 5:30pm is = %f\" % profile.basal.value_at_date(five_thirty_pm)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library that provides a Python interface to Nightscout",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/ps2/python-nightscout"
},
"split_keywords": [
"nightscout",
"api",
"client",
"development"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "38d7abf4f6277f6e76f2b5acc42e99552d55edc19c1915df52252d0b4d4b727c",
"md5": "66e1d4f7c787d9897550a519ca069c32",
"sha256": "024dce2007e04d2e34fceab595b51ac0deff8a45cf838db0512095706610c18b"
},
"downloads": -1,
"filename": "python_nightscout-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "66e1d4f7c787d9897550a519ca069c32",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6958,
"upload_time": "2023-10-15T08:27:51",
"upload_time_iso_8601": "2023-10-15T08:27:51.512786Z",
"url": "https://files.pythonhosted.org/packages/38/d7/abf4f6277f6e76f2b5acc42e99552d55edc19c1915df52252d0b4d4b727c/python_nightscout-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "67c7d3e5e9479eb00f83ed452fb6bd8a7d609e549c1b2b2f462f821d8f5dacbd",
"md5": "584c3f3c313d6a38310e6b05dca7095e",
"sha256": "7326cd1a57992597a1e64eaa210e67fc273f7b8097bbdf500ae7e830347ce824"
},
"downloads": -1,
"filename": "python-nightscout-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "584c3f3c313d6a38310e6b05dca7095e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7463,
"upload_time": "2023-10-15T08:27:52",
"upload_time_iso_8601": "2023-10-15T08:27:52.899293Z",
"url": "https://files.pythonhosted.org/packages/67/c7/d3e5e9479eb00f83ed452fb6bd8a7d609e549c1b2b2f462f821d8f5dacbd/python-nightscout-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-15 08:27:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ps2",
"github_project": "python-nightscout",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "python-nightscout"
}