Skip to content

ibury08/py-google-fit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py_google_fit

A convenience package for accessing your Google Fit data. It wraps the google python into a few functions to easily access your data. This library is written with read-only intention in mind. There are no helper functions to write to your Google Fit data.

Getting started

Clone this repo and install it into your python environment

git clone https://github.com/timvancann/py-google-fit.git
cd py-google-fit && python setup.py install

Authentication

Start by creating an instance of the GoogleFit object:

from py_google_fit.GoogleFit import GoogleFit
fit = GoogleFit(client_id, client_secret)

Fill in your own client_id and client_secret, create them in your Google developer console

To authenticate, call the authenticate function:

fit.authenticate()

By default it will request read access to three google fit scopes of your account: body, activity and nutrition. If you haven't ran this function before. A browser will open asking you to give access.

Getting your data

Currently supported data is steps and weight. Feel free request more or create a PR.

To get your stepcount for today up till now:

from py_google_fit.GoogleFit import GFitDataType
fit.average_today(GFitDataType.STEPS)

And similar for your weight:

fit.average_today(GFitDataType.WEIGHT)

To get some trend data, a rolling average is usually a good metric:

fit.rolling_daily_average(GFitDataType.STEPS, n=14)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%