Friday, June 15, 2012

Fat Secret calorie counter access with python

This post complements my earlier discussion of the Withings scale API here:
I've written a convenience library in python that simplifies the process of retrieving protein, carbohydrate, fat, and calorie data from Fatsecret along with several other features from the REST API. To make use of the library you'll need to register as a developer at the link below:
After registering you will be given a consumer/API key and secret which you will need to use my python library. Once you have your key and secret, download the python library with the following command:

git clone

The library comes with the example below that demonstrates its usage. To use the example, replace the strings 'your_key_goes_here' and 'your_secret_goes_here' with the key and secret you were assigned after registering as a developer.
Note that the example above makes use of pandas to plot timeseries. You can get the latest pandas with this command:

git clone

I've tested the example above with the stable 0.7.3 release as well.
Once you paste your key and secret into place and install pandas you can run the example as follows:


Assuming you already have some data recorded with fatsecret, you should get a plot like the one below after running (click on the image to see a larger copy):