Skip to content

iandday/python-nokia

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python library for the Nokia Health API

Build Status Coverage Status Requirements Status

Nokia Health API https://developer.health.nokia.com/api/doc

Uses Oauth 1.0 to authentify. You need to obtain a consumer key and consumer secret from Nokia by creating an application here: https://developer.health.nokia.com/en/partner/add

Installation:

pip install nokia

Usage:

from nokia import NokiaAuth, NokiaApi
from settings import CONSUMER_KEY, CONSUMER_SECRET

auth = NokiaAuth(CONSUMER_KEY, CONSUMER_SECRET)
authorize_url = auth.get_authorize_url()
print("Go to %s allow the app and copy your oauth_verifier" % authorize_url)

oauth_verifier = raw_input('Please enter your oauth_verifier: ')
creds = auth.get_credentials(oauth_verifier)

client = NokiaApi(creds)
measures = client.get_measures(limit=1)
print("Your last measured weight: %skg" % measures[0].weight)

Saving Credentials:

nokia saveconfig --consumer-key [consumerkey] --consumer-secret [consumersecret] --config nokia.cfg`

Which will save the necessary credentials to nokia.cfg

Using Saved Credentials

from nokia import NokiaAuth, NokiaApi, NokiaCredentials
from settings import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET, USER_ID

creds = NokiaCredentials(ACCESS_TOKEN, ACCESS_TOKEN_SECRET, CONSUMER_KEY, CONSUMER_SECRET, USER_ID)
client = NokiaApi(creds)

measures = client.get_measures(limit=1)
print("Your last measured weight: %skg" % measures[0].weight)

Running From Command line:

nokia [command] --config nokia.cfg 

About

Library for the Nokia Health API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%